Files
qhmes/web-dist/js/useCgformList-DB4lEeRS.js
2026-06-16 18:19:57 +08:00

2 lines
7.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var h=(o,l,n)=>new Promise((d,p)=>{var w=u=>{try{a(n.next(u))}catch(i){p(i)}},M=u=>{try{a(n.throw(u))}catch(i){p(i)}},a=u=>u.done?d(u.value):Promise.resolve(u.value).then(w,M);a((n=n.apply(o,l)).next())});import{f,E as y,r as C,p as Se,i as g,n as ke}from"./vue-vendor-DNhG1Cve.js";import"./index-BDvqZ5j4.js";import"./index-D9GWo192.js";import{u as De}from"./useListPage-CK9oQ-1O.js";import{l as Ee,d as Fe,a as xe,b as Le,c as Ae,e as $e,f as Be,g as Oe}from"./CgformModal-BMqGzcrR.js";import{s as Re,aE as Ie,b5 as k,aP as Je,aG as Ne}from"./index-X7Y8jykP.js";import{u as Ue}from"./cgformState-DUaj-JfG.js";import{a as Ye}from"./useDrawer-BDPywy9W.js";import{u as c}from"./useModal-DaJ3Bflg.js";import"./index-DfHu-LAS.js";import{e as Ge,R as $}from"./Group-DBzJABA_.js";var O=(o=>(o[o.normal=0]="normal",o[o.copy=1]="copy",o))(O||{});const{createConfirm:je}=Re();function B(o,l){const{destroy:n}=je({title:"确认删除表单吗?",content:()=>f("div",{style:"font-size: 13px; color: #666; line-height: 1.8;"},[f("div",null,[y("移除:仅删除配置,保留数据库表和数据")]),f("div",null,[y("删除:同时删除数据库表和数据(不可恢复)")])]),iconType:"info",closable:!0,maskClosable:!0,width:400,footer:()=>f("div",{style:"text-align: right; margin-top: 12px;"},[f(Ie,null,{default:()=>[f(k,{onClick:()=>n()},{default:()=>[y("取消")]}),f(k,{type:"primary",ghost:!0,onClick:d(l)},{default:()=>[y("移除表单")]}),f(k,{type:"primary",danger:!0,onClick:d(o)},{default:()=>[y("删除表单")]})]})])});function d(p){return()=>h(null,null,function*(){yield p(),n()})}}function nt(o){const l=o.pageType===O.normal,n=Se(),d=Ue(),p=C(),w=De({designScope:o.designScope,tableProps:{api:Ee,columns:o.columns,formConfig:{schemas:o.formSchemas},beforeFetch:e=>{let t=l?0:1,s=l?void 0:n.currentRoute.value.params.code;return Je(e.tableType_MultiString)&&(e.tableType_MultiString=e.tableType_MultiString.join(",")),Object.assign(e,{copyType:t,physicId:s})}}}),{tableContext:M,createMessage:a,createConfirm:u}=w,[,{reload:i,setLoading:T},{selectedRowKeys:D,selectedRows:r}]=M,[R,E]=c(),[I,J]=c(),[N,U]=c(),[Y,G]=c(),[j,P]=c(),[V,_]=c(),[q,z]=c(),[K,H]=c(),[Q,W]=Ye(),[X,Z]=c();function ee(){E.openModal(!0,{isUpdate:!1})}function te(){U.openModal(!0)}function ne(){i()}let m=null;function ae(e){m=e,E.openModal(!0,{isUpdate:!0,record:e})}function oe(){m!=null&&m.id&&(d.addChangedTable(m.id),m=null),i()}function le(e){return h(this,null,function*(){yield $e(e),i()})}function F(e){return h(this,null,function*(){yield Ae(e),i()})}function ie(e){return B(()=>le(e.id),()=>F(e.id))}function se(){let e=D.value;if(e.length<=0){a.warning("请先选择一条记录!");return}B(()=>x(Oe,e,!0),()=>x(Be,e,!0))}function x(e,t,s=!1){return h(this,null,function*(){try{T(!0);const S=yield e(t);return i(),s&&(D.value=[]),S}finally{T(!1)}return Promise.reject()})}function ue(){v(([e])=>P.openModal(!0,{row:e}))}function ce(){v(([e])=>_.openModal(!0,{row:e}))}function re(){v(([e])=>z.openModal(!0,{row:e}))}function fe(){v(([e])=>H.openModal(!0,{row:e}))}function pe(){J.openModal(!0,{})}function v(e,t=1,s=1){r.value.length<t?a.warning(`请先至少选中 ${t} 条记录`):r.value.length>s?a.warning(`最多只能选中 ${t} 条记录`):e(r.value)}function de(){if(r.value.length===0)a.warning("请先选中一条记录");else if(r.value.length>1)a.warning("代码生成只能选中一条记录");else{let e=r.value[0];e?e.isDbSynch!="Y"?a.warning("请先同步数据库!"):e.tableType==3?a.warning("请选中该表对应的主表"):G.openModal(!0,{code:e.id}):a.warning("请选中当前页的数据!")}}function me(e){if(e.isTree=="Y")n.push({path:"/online/cgformTreeList/"+e.id});else switch(e.themeTemplate){case"erp":n.push({path:"/online/cgformErpList/"+e.id});break;case"tab":n.push({path:"/online/cgformTabList/"+e.id});break;case"innerTable":n.push({path:"/online/cgformInnerTableList/"+e.id});break;default:n.push({path:"/online/cgformList/"+e.id});break}}function he(e){const t=C("normal"),s=C(!1),S=u({iconType:"info",title:"同步数据库",content:()=>g("div",{style:"margin: 20px 0;"},g(Ge,{value:t.value,disabled:s.value,"onUpdate:value":b=>t.value=b},()=>[g($,{value:"normal"},()=>"普通同步(保留表数据)"),g($,{value:"force"},()=>"强制同步(删除表,重新生成)")])),maskClosable:!0,okText:"开始同步",onOk(){return h(this,null,function*(){s.value=!0,S.update({maskClosable:!1,keyboard:!1,okText:"同步中…",okButtonProps:{loading:s.value},cancelButtonProps:{disabled:s.value}});try{yield xe(e.id,t.value)}catch(b){}finally{yield i(),ke(()=>{r.value.length&&r.value.forEach(b=>{var A;const L=((A=p.value.getDataSource())!=null?A:[]).find(Me=>Me.id===b.id);L&&Object.assign(b,L)})})}})}})}const[ge,be]=c();function ye(e){let t;e.themeTemplate==="erp"?t=`/online/cgformErpList/${e.id}`:e.themeTemplate==="innerTable"?t=`/online/cgformInnerTableList/${e.id}`:e.themeTemplate==="tab"?t=`/online/cgformTabList/${e.id}`:e.isTree=="Y"?t=`/online/cgformTreeList/${e.id}`:t=`/online/cgformList/${e.id}`,be.openModal(!0,{title:`菜单链接${e.tableTxt}`,content:t,copyText:t,copyTitle:`${e.tableTxt}`,record:e})}function we(e){const t=C(e.tableName+"_copy");u({title:"复制表",content:()=>g("div",{style:"margin: 20px 0;"},["请输入新表名:",g(Ne,{value:t.value,"onUpdate:value":s=>t.value=s})]),iconType:"info",closable:!0,okText:"复制",onOk(){t.value?t.value===e.tableName?a.warning("新表名和旧表名不能一致"):Le(e.id,t.value).then(i):a.warning("请输入新表名")}})}function Te(e){u({title:"删除",content:"确定要删除该视图吗?",iconType:"warning",closable:!0,maskClosable:!0,onOk:()=>{F(e.id)}})}function ve(e){return[{label:"编辑",onClick:()=>ae(e)}]}function Ce(e){return[{label:"同步数据库",onClick:()=>he(e),ifShow:()=>l&&e.isDbSynch!="Y"},{label:"功能测试",class:["low-app-hide"],onClick:()=>me(e),ifShow:()=>l?e.isDbSynch=="Y"&&e.tableType!==3:!0},{label:"配置地址",class:["low-app-hide"],onClick:()=>ye(e),ifShow:()=>l?e.isDbSynch=="Y"&&e.tableType!==3:!0},{label:"权限控制",onClick:()=>W.openDrawer(!0,{cgformId:e.id,tableType:e.tableType})},{label:"角色授权",onClick:()=>Z.openModal(!0,{cgformId:e.id})},{label:"视图管理",class:["low-app-hide"],onClick:()=>n.push(`/online/copyform/${e.id}`),ifShow:()=>l&&e.hascopy==1},{label:"生成视图",class:["low-app-hide"],popConfirm:{title:"确定生成视图吗",placement:"left",confirm:()=>{T(!0),Fe(e.id).then(()=>{a.success("已成功生成视图")}).finally(()=>{T(!1),i()})}},ifShow:()=>l},{label:"复制表",onClick:()=>we(e),ifShow:()=>l},{label:"删除",onClick:()=>ie(e),ifShow:()=>l},{label:"删除视图",onClick:()=>Te(e),ifShow:()=>!l}]}return{router:n,pageContext:w,onAdd:ee,onAiCreateTable:te,onSuccess:oe,onDeleteBatch:se,onImportDbTable:pe,onGenerateCode:de,onShowCustomButton:ue,onShowEnhanceJs:ce,onShowEnhanceSql:re,onShowEnhanceJava:fe,onCreateAiTable:ne,getTableAction:ve,getDropDownAction:Ce,registerCustomButtonModal:j,registerEnhanceJsModal:V,registerEnhanceSqlModal:q,registerEnhanceJavaModal:K,registerAuthManagerDrawer:Q,registerAuthSetterModal:X,registerCgformModal:R,registerDbToOnlineModal:I,registerCodeGeneratorModal:Y,registerAiToOnlineModal:N,registerAddressModal:ge,tableRef:p}}export{O as C,nt as u};