Files
qhmes/deploy-qhmes/frontend/js/EnhanceJsModal-BPBW520t-CaXgRitB.js
2026-05-15 11:34:12 +08:00

89 lines
17 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.
import{d as q,f as m,r as j,ah as g,aC as C,as as w,aF as o,k as l,ag as k,au as b,G as F}from"./vue-vendor-C7Zq48Yl.js";import{B as W}from"./index-Du0A3ksf.js";import"./index-Di-j2gt4.js";import{J as L}from"./useOnlineTest-_onDRxjY-Mu0PhkZd.js";import{u as Q,E as z}from"./EnhanceJsHistory-De17P14L-CBMZnd4h.js";import{q as X,b as Y}from"./enhance.api-BqHb-YGL-DLA1Agkf.js";import{u as Z,ak as ee,al as te}from"./index-BI6CMai0.js";import{T as se,bL as oe}from"./antd-vue-vendor-BPnV8VqP.js";import{h as ie}from"./main.index-Cs5ETdXF.js";import ae from"./JCodeEditor-CLVZA7Uj.js";import"./BasicModal-0sAdFEk_.js";import"./ModalHeader-keHdAHWH.js";import"./useTimeout-DDl4l82I.js";import"./vxe-table-vendor-B88kchpX.js";import"./index-DeEq83Ov.js";import"./useWindowSizeFn-PRZSD86C.js";import"./index-pxs5MULf.js";import"./index-BgYCgfME.js";import"./index-f8O7TghW.js";import"./useIntersectionObserver-BMxdTqP3.js";import"./BasicForm-BJnSRkIE.js";import"./componentMap-BBZeqR-K.js";import"./useFormItem-BdW6EoZe.js";import"./download-UE0L9Rfp.js";import"./base64Conver-24EVOS6V.js";import"./index-CIBZG4nR.js";import"./index-BhQEwnQQ.js";import"./useCountdown-DqnNWBp6.js";import"./useFormItemSingle-BbRhswfn.js";import"./JSelectUser-B71zikzw.js";import"./props-DAezUTeZ.js";import"./JSelectBiz-CnEaVMUF.js";import"./JAddInput-D6qcyZjQ.js";import"./areaDataUtil-CbYCy3Ig.js";import"./index-CNkz_PUv.js";import"./index-CUdllngZ.js";import"./bem-EhXRi4nW.js";import"./props-D4vdsy3J.js";import"./useContextMenu-Cwx1lIOK.js";import"./depart.api-DeMNV8zW.js";import"./TreeIcon-DE4jdeZV.js";import"./JSelectDept-DRDVeruW.js";import"./JPopup-Bva6u6tk.js";import"./usePopBiz-CG0vVpgI.js";import"./useMethods-DVip17X8.js";import"./index-Dg4HCEvo.js";import"./JEllipsis-DqRFTSm0.js";import"./JUpload-Cz9HN61B.js";import"./index-MGIrEF-A.js";import"./index-MREkPhsT.js";import"./useForm-BZtHZyx2.js";import"./JAreaLinkage-BeRUFHSB.js";import"./EasyCronInput-7xfJ3nBh.js";import"./htmlmixed-NhwyF9-q.js";import"./vue-CgbRSACy.js";/* empty css */var S=(e,t,h)=>new Promise((f,x)=>{var i=a=>{try{p(h.next(a))}catch(n){x(n)}},r=a=>{try{p(h.throw(a))}catch(n){x(n)}},p=a=>a.done?f(a.value):Promise.resolve(a.value).then(i,r);p((h=h.apply(e,t)).next())});const N={list:[{text:".acceptHrefParams",displayText:"acceptHrefParams",superiors:"this",desc:"获取地址栏上的条件"},{text:".currentPage",displayText:"currentPage",superiors:"this",desc:"获取当前页数默认1"},{text:".currentTableName",displayText:"currentTableName",desc:"获取当前表名"},{text:".description",displayText:"description",superiors:"this",desc:"获取当前表描述"},{text:".hasChildrenField",displayText:"hasChildrenField",superiors:"this",desc:"如果是树形列表,获取是否有子节点字段名"},{text:".ID",displayText:"ID",superiors:"this",desc:"获取当前表的配置ID"},{text:".pageSize",displayText:"pageSize",superiors:"this",desc:"获取当前每页条数默认10"},{text:".queryParam",displayText:"queryParam",superiors:"this",desc:"获取查询表单的查询条件"},{text:".selectedRowKeys",displayText:"selectedRowKeys",superiors:"this",desc:"获取选中行的id的数组"},{text:".selectedRows",displayText:"selectedRows",superiors:"this",desc:"获取选中行的数据数组"},{text:".sortField",displayText:"sortField",superiors:"this",desc:"获取排序字段默认id"},{text:".sortType",displayText:"sortType",superiors:"this",desc:"获取排序类型默认升序asc"},{text:".total",displayText:"total",superiors:"this",desc:"获取总条数"},{text:".loading",displayText:"loading",superiors:"this",desc:"设置/获取loading"},{text:".loadData()",displayText:"loadData()",superiors:"this",desc:"加载数据"},{text:".clearSelectedRow()",displayText:"clearSelectedRow()",superiors:"this",desc:"清除选中的行"},{text:".getLoadDataParams()",displayText:"getLoadDataParams()",superiors:"this",desc:"获取所有的查询条件,返回一个对象,包括:查询表单,高级查询,地址栏参数,分页信息,排序信息等"},{text:".isTree()",displayText:"isTree()",superiors:"this",desc:"判断当前表是不是树,返回布尔值"},{text:`beforeEdit(row){
return new Promise((resolve, reject) => {
if(row.字段名 == '字段值'){
reject('测试~');
}else{
resolve();
}
})
}`,displayText:"beforeEdit(row){}",desc:"点击操作列下的编辑按钮触发返回promise对象"},{text:`beforeDelete(row){
return new Promise((resolve, reject) => {
if(row.字段名 == '字段值'){
reject('测试~');
}else{
resolve();
}
})
}`,displayText:"beforeDelete(row){}",desc:"点击操作列下的删除按钮触发返回promise对象"},{text:"console.log()",displayText:"console.log()",desc:"打印日志"}],form:[{text:".loading",displayText:"loading",superiors:"this",desc:"是否加载中返回的是一个ref对象"},{text:".isUpdate",displayText:"isUpdate",superiors:"this",desc:"是否是编辑页面返回的是一个ref对象"},{text:".onlineFormRef",displayText:"onlineFormRef",superiors:"this",desc:"主表/单表表单的ref对象"},{text:".refMap",displayText:"refMap",superiors:"this",desc:"子表表单/子表table的ref对象mapkey为子表表名"},{text:".subActiveKey",displayText:"subActiveKey",superiors:"this",desc:"子表的激活的tab索引值对应的字符串0开始返回的是一个ref对象"},{text:".sh",displayText:"sh",superiors:"this",desc:"单表/主表字段的显示隐藏状态"},{text:".submitFlowFlag",displayText:"submitFlowFlag",superiors:"this",desc:"是否提交表单后自动提交流程返回一个ref对象"},{text:".subFormHeight",displayText:"subFormHeight",superiors:"this",desc:"一对一子表表单的高度不需要设置返回一个ref对象"},{text:".subTableHeight",displayText:"subTableHeight",superiors:"this",desc:"一对多子表table的高度不需要设置返回一个ref对象"},{text:".tableName",displayText:"tableName",superiors:"this",desc:"当前表名返回的是一个ref对象"},{text:".$nextTick",displayText:"$nextTick",superiors:"this",desc:"调用的是vue3的nextTick"},{text:".字段名_load",displayText:"字段名_load",superiors:"this",desc:"控制字段的加载与否设置为false表示当前字段不加载"},{text:".字段名_disabled",displayText:"字段名_disabled",superiors:"this",desc:"控制字段的禁用与否设置为true表示当前字段禁用"},{text:".addSubRows(tableName, rows)",displayText:"addSubRows(tableName, rows)",superiors:"this",desc:"往一对多子表table里添加数据"},{text:".changeOptions(field, options)",texdisplayTextt:"changeOptions(field, options)",superiors:"this",desc:"改变单表/主笔 下拉控件的下拉选项"},{text:".clearSubRows(tableName)",displayText:"clearSubRows(tableName)",superiors:"this",desc:"清空一对多子表table的数据"},{text:".clearThenAddRows(tableName, rows)",displayText:"clearThenAddRows(tableName, rows)",superiors:"this",desc:"先清空一对多子表table的数据再往里添加数据"},{text:".getFieldsValue()",displayText:"getFieldsValue()",superiors:"this",desc:"获取主表/单表 所有字段的值"},{text:".getSubTableInstance(tableName)",displayText:"getSubTableInstance(tableName)",superiors:"this",desc:"获取子表的实例对象这个对象可以调用子表table的方法"},{text:".setFieldsValue(row)",displayText:"setFieldsValue(row)",superiors:"this",desc:"设置主表/单表 字段的值"},{text:".triggleChangeValues(values,id,target)",displayText:"triggleChangeValues(values,id,target)",superiors:"this",desc:"改变单表/主表/子表 字段的值一般用于change事件其中idtarget需要通过change事件的内置参数获取如果不传idtarget的值则改变的是主表的字段"},{text:".triggleChangeValue(field, value)",displayText:"triggleChangeValue(field, value)",superiors:"this",desc:"设置单表/主表 字段的值"},{text:".onlineFormValueChange(field, value, otherValus)",displayText:"onlineFormValueChange(field, value, otherValus)",superiors:"this",desc:"定义后当表单值改变的时候会触发该方法因js增强hook方式不支持原来的onlChange所以定义此方法"},{text:".changeSubTableOptions(tableNamefieldoptions)",displayText:"changeSubTableOptions(tableNamefieldoptions)",superiors:"this",desc:"改变一对一子表下拉框options"},{text:".changeSubFormbleOptions(tableNamefieldoptions)",displayText:"changeSubFormbleOptions(tableNamefieldoptions)",superiors:"this",desc:"改变一对多子表下拉框options"},{text:".changeRemoteOptions({ field, dict, label, type?, subTableName? })",displayText:"changeRemoteOptions({ field, dict, label, type?, subTableName? })",superiors:"this",desc:"改变动态下拉框options"},{text:".submitFormAndFlow()",displayText:"submitFormAndFlow()",superiors:"this",desc:"表单提交且发起流程"},{text:`beforeSubmit(row){
return new Promise((resolve, reject)=>{
//此处模拟等待时间,可能需要发起请求
setTimeout(()=>{
if(row.字段名 == '字段值'){
// 当某个字段不满足要求的时候可以reject
reject('测试~');
}else{
resolve();
}
},3000)
})
}`,displayText:"beforeSubmit(row){}",desc:"提交前置事件"},{text:`loaded(){
this.$nextTick(()=>{
// let text = '测试js增强设置默认值';
// if(this.isUpdate.value === true){
// text = '测试js增强修改表单值';
// }
this.setFieldsValue({
字段名: 修改的值
})
})
}`,displayText:"loaded(){}",desc:"表单加载事件"},{text:`onlChange(){
return {
字段名(){
let value = event.value
console.log(value)
this.triggleChangeValues({'字段名': '修改后的值'})
}
}
}`,displayText:"onlChange(){}",desc:"单表#表单值改变事件"},{text:`子表名_onlChange(){
return {
字段名(){
let value = event.value;
console.log(value);
let row = {'字段名': '测试一对多值改变'+value};
this.triggleChangeValues(row, event.row.id, event.target)
}
}
}`,displayText:"子表名_onlChange(){}",desc:"子表#表单值改变事件"},{text:`子表名_onlChange(){
return {
子表字段01(){
this.getSubTableInstance('子表名').getValues((err,values)=>{
this.triggleChangeValues({'主表字段名': '修改后的值'})
})
},
}
}
`,displayText:"子表名_onlChange(){}",desc:"子改主#表单值改变事件"},{text:`onlChange(){
return {
字段名01(){
let value = event.value
this.changeOptions('字段名02', '修改后的值');
}
字段名02(){
let value = event.value
this.changeOptions('字段名03', '修改后的值');
}
}
}`,displayText:"changeOptions()",desc:"js增强实现下拉联动"},{text:"console.log()",displayText:"console.log()",desc:"打印日志"}],common:[{text:`getAction('请求url', { 'key': 'value'}).then(res => {
console.log(res)
})`,displayText:"getAction(url, param)",desc:"get请求"},{text:`postAction('请求url', { 'key': 'value'}).then(res => {
console.log(res)
})`,displayText:"postAction(url, param)",desc:"post请求"},{text:`putAction('请求url', { 'key': 'value'}).then(res => {
console.log(res)
})`,displayText:"putAction(url, param)",desc:"put请求"},{text:`deleteAction('请求url', { 'key': 'value'}).then(res => {
console.log(res)
})`,displayText:"deleteAction(url, param)",desc:"delete请求"},{text:"this",displayText:"this",desc:"上下文"},{text:".openCustomModal({title,width,row,formComponent,requestUrl,hide,show})",displayText:"openCustomModal({title,width,row,formComponent,requestUrl,hide,show})",desc:"打开一个弹窗-参考 Js增强打开自定义弹窗"}]},le=q({name:"EnhanceJs",components:{BasicModal:W,JCodeEditor:ae,EnhanceJsHistory:z,QuestionCircleOutlined:oe,Tooltip:se},emits:["register"],setup(){const{createMessage:e}=Z(),t=Q(),h=m(),f=m(),x=j({form:{},list:{}}),i=m("list"),r=m(""),p=m(!1),a=m(!1),n=m(""),y=j({form:"",list:""}),c={form:!1,list:!1},T=m(!1),R=[...N.list,...N.common],V=[...N.form,...N.common],d=m("240px"),[H,{closeModal:J}]=ee(s=>S(null,null,function*(){K(s.row)})),[O,D]=te(),{aiTestMode:P,genEnhanceJsData:A}=L();function K(s){r.value=s.id,a.value=!1,n.value=s.tableName;let u=t.getEnhanceJs(r.value);(u==null?void 0:u.length)>0?(i.value=u[u.length-1].type,p.value=!0):p.value=!1,c.form=!1,c.list=!1,i.value?E(i.value):E("form"),T.value=!0,setTimeout(()=>T.value=!1,150)}function B(){return S(this,null,function*(){yield Promise.all([_("form"),_("list")]),J(),e.success("保存成功")})}function _(s){return S(this,null,function*(){let u=x[s],v={cgJs:y[s],cgJsType:s};if(!c[s]||u.cgJs===v.cgJs)return;let M=!!u.id;M&&(v=Object.assign({},u,v)),yield X(r.value,v,M),t.addEnhanceJs({code:r.value,str:v.cgJs,type:v.cgJsType,date:new Date().getTime()})})}function I(){J()}function E(s){return S(this,null,function*(){i.value=s;try{if(!c[s]){let u=yield Y(r.value,s);Object.assign(x[s],{id:null},u),y[s]=x[s].cgJs,c[s]=!0}}catch(u){}setTimeout(()=>{s=="list"?f.value.refresh():h.value.refresh()},150)})}function U(){D.openModal(!0,{code:r.value,type:i.value})}function $(s){y[i.value]!=s&&(a.value=!0,y[i.value]=s)}function G(){i.value==="form"?A(n.value,i.value,h.value):A(n.value,i.value,f.value)}return{formEditorRef:h,listEditorRef:f,reloading:T,enhanceValues:y,enhanceType:i,showHistory:p,aiTestMode:P,tableName:n,genEnhanceJsData:A,onGenTestData:G,onChangeType:E,onCodeChange:$,onShowHistory:U,onSubmit:B,onCancel:I,registerModal:H,registerEnhanceJsHistory:O,listKeyWords:R,formKeyWords:V,handleGo:s=>{window.open(`https://help.jeecg.com/java/online/enhanceJs/${s}`)},codeEditorHeight:d,handleFullScreenChange:s=>{s?d.value=`${document.documentElement.clientHeight-250}px`:d.value="240px"}}}}),re={class:"titleBox"},ne={class:"titleBox"};function de(e,t,h,f,x,i){const r=g("QuestionCircleOutlined"),p=g("Tooltip"),a=g("JCodeEditor"),n=g("a-tab-pane"),y=g("a-tabs"),c=g("a-button"),T=g("a-space"),R=g("EnhanceJsHistory"),V=g("BasicModal");return w(),C(V,{onRegister:e.registerModal,title:"JS增强",width:800,onFullScreen:e.handleFullScreenChange},{footer:o(()=>[l(T,null,{default:o(()=>[l(c,{onClick:e.onCancel},{default:o(()=>[...t[9]||(t[9]=[F("关闭",-1)])]),_:1},8,["onClick"]),l(c,{type:"primary",onClick:e.onSubmit},{default:o(()=>[...t[10]||(t[10]=[F("确定",-1)])]),_:1},8,["onClick"])]),_:1}),l(T,{style:{float:"left"}},{default:o(()=>[e.showHistory?(w(),C(c,{key:0,onClick:e.onShowHistory},{default:o(()=>[...t[11]||(t[11]=[F("查看历史版本",-1)])]),_:1},8,["onClick"])):k("",!0),e.aiTestMode?(w(),C(c,{key:1,onClick:e.onGenTestData},{default:o(()=>[...t[12]||(t[12]=[F("生成测试数据",-1)])]),_:1},8,["onClick"])):k("",!0)]),_:1})]),default:o(()=>[l(y,{activeKey:e.enhanceType,"onUpdate:activeKey":t[4]||(t[4]=d=>e.enhanceType=d),onChange:e.onChangeType},{default:o(()=>[l(n,{key:"form",forceRender:""},{tab:o(()=>[b("div",re,[t[6]||(t[6]=b("span",{class:"title"},"form",-1)),l(p,null,{title:o(()=>[...t[5]||(t[5]=[b("span",null,"表单js增强文档",-1)])]),default:o(()=>[l(r,{onClick:t[0]||(t[0]=d=>e.handleGo("form"))})]),_:1})])]),default:o(()=>[!e.reloading&&e.enhanceType==="form"?(w(),C(a,{key:0,ref:"formEditorRef",value:e.enhanceValues.form,"onUpdate:value":t[1]||(t[1]=d=>e.enhanceValues.form=d),language:"javascript",fullScreen:!0,lineNumbers:!1,height:e.codeEditorHeight,"language-change":!1,onChange:e.onCodeChange,keywords:e.formKeyWords,placeholder:`代码提示技巧:
全局对象: this.调用属性或方法
事件方法beforeSubmitloadedonlChangegetActionpostActionputActiondeleteActiondeleteActionopenCustomModal等`},null,8,["value","height","onChange","keywords"])):k("",!0)]),_:1}),l(n,{key:"list",forceRender:""},{tab:o(()=>[b("div",ne,[t[8]||(t[8]=b("span",{class:"title"},"list",-1)),l(p,null,{title:o(()=>[...t[7]||(t[7]=[b("span",null,"列表js增强文档",-1)])]),default:o(()=>[l(r,{onClick:t[2]||(t[2]=d=>e.handleGo("list"))})]),_:1})])]),default:o(()=>[!e.reloading&&e.enhanceType==="list"?(w(),C(a,{key:0,ref:"listEditorRef",value:e.enhanceValues.list,"onUpdate:value":t[3]||(t[3]=d=>e.enhanceValues.list=d),language:"javascript",fullScreen:!0,lineNumbers:!1,height:e.codeEditorHeight,"language-change":!1,onChange:e.onCodeChange,keywords:e.listKeyWords,placeholder:`代码提示技巧:
全局对象: this.调用属性或方法
事件方法beforeDelete、beforeEdit、getAction、postAction、putAction、deleteAction、deleteAction、openCustomModal等`},null,8,["value","height","onChange","keywords"])):k("",!0)]),_:1})]),_:1},8,["activeKey","onChange"]),l(R,{onRegister:e.registerEnhanceJsHistory},null,8,["onRegister"])]),_:1},8,["onRegister","onFullScreen"])}const ct=ie(le,[["render",de],["__scopeId","data-v-2d051fd7"]]);export{ct as default};