UNPKG

goldpankit

Version:

GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。

2 lines (1 loc) 27.7 kB
import{_ as k,o as n,c,F as S,f as F,H as x,t as f,r as s,g as _,w as b,a as h,j as C,b as y,e as w,m as K,D as q,a6 as B,z as D,A as Q,p as O,l as U,a1 as R,a7 as N}from"./index-99dec0ae.js";import{Q as P}from"./QueryModelView-10e89f9d.js";const z={name:"InstallCheckbox",props:{modelValue:{type:Array},type:{default:"checkbox"},options:{}},data(){return{}},computed:{optionValues(){return this.options.map(l=>l.value)}},watch:{modelValue:{immediate:!0,handler(){this.filterValues(this.modelValue)}},optionValues(){this.filterValues(this.modelValue)}},methods:{handleSelect(l){let t=this.modelValue.findIndex(d=>d===l.value),e=[];t===-1?e=this.modelValue.concat([l.value]):e=this.modelValue.filter((d,i)=>i!==t),this.filterValues(e)},filterValues(l){const t=[];for(const e of l)this.options.find(i=>i.value===e)!=null&&t.push(e);t!==this.modelValue&&(t!=null&&this.modelValue!=null&&t.join(",")===this.modelValue.join(",")||(this.$emit("update:modelValue",t),this.$emit("change",t)))}}},X={key:0,class:"installer-checkbox"},Y=["onClick"],Z={key:1};function ee(l,t,e,d,i,o){return e.options.length>0?(n(),c("ul",X,[(n(!0),c(S,null,F(e.options,r=>(n(),c("li",{key:r.value,class:x({selected:e.modelValue==null?!1:e.modelValue.findIndex(v=>v===r.value)!==-1}),onClick:v=>o.handleSelect(r)},f(r.label),11,Y))),128))])):(n(),c("p",Z,"Please add options first."))}const $=k(z,[["render",ee],["__scopeId","data-v-24b20c0d"]]);const le={name:"InstallInput",props:{type:{default:"text"},rows:{default:3}}};function te(l,t,e,d,i,o){const r=s("el-input");return n(),_(r,{type:e.type,rows:e.rows,class:"install-input"},null,8,["type","rows"])}const W=k(le,[["render",te],["__scopeId","data-v-35abcc78"]]);const ne={name:"InstallRadio",props:{modelValue:{},options:{}},data(){return{optionSettingData:{visible:!1}}},methods:{handleSelect(l){this.$emit("update:modelValue",l),this.$emit("change",l)}}},ae={key:0,class:"installer-radio"},oe=["onClick"],ie={key:1};function se(l,t,e,d,i,o){return e.options.length>0?(n(),c("ul",ae,[(n(!0),c(S,null,F(e.options,r=>(n(),c("li",{key:r.value,class:x({selected:e.modelValue===r.value}),onClick:v=>o.handleSelect(r.value)},f(r.label),11,oe))),128))])):(n(),c("p",ie,"Please add options first."))}const E=k(ne,[["render",se],["__scopeId","data-v-801a3273"]]);const ue={name:"MySqlFieldSelect",props:{modelValue:{},table:{required:!0},multiple:{default:!0}},methods:{handleInput(l){this.$emit("update:modelValue",l.map(t=>this.table.fields.find(e=>e.name===t)).filter(t=>t!=null))}}},de={class:"option-content"},re={class:"text-info-1"};function ce(l,t,e,d,i,o){const r=s("el-option"),v=s("el-select");return n(),_(v,{class:"mysql-field-select","popper-class":"mysql-field-select__popper",multiple:e.multiple,"model-value":e.modelValue==null?[]:e.modelValue.map(p=>p.name),"onUpdate:modelValue":o.handleInput},{default:b(()=>[(n(!0),c(S,null,F(e.table.fields,p=>(n(),_(r,{value:p.name,label:p.name},{default:b(()=>[h("p",de,[h("span",null,f(p.name),1),h("span",re,f(p.comment),1)])]),_:2},1032,["value","label"]))),256))]),_:1},8,["multiple","model-value","onUpdate:modelValue"])}const me=k(ue,[["render",ce],["__scopeId","data-v-af47228f"]]);const _e={name:"OptionValueInput",props:{modelValue:{},optionSetting:{required:!0}},methods:{emitChange(l){this.$emit("update:model-value",l),this.$emit("input",l)}}},he={class:"option-value-input"};function pe(l,t,e,d,i,o){const r=s("el-input"),v=s("el-input-number");return n(),c("div",he,[e.optionSetting.inputType==="input"?(n(),_(r,{key:0,"model-value":e.modelValue,"onUpdate:modelValue":o.emitChange},null,8,["model-value","onUpdate:modelValue"])):e.optionSetting.inputType==="number_input"?(n(),_(v,{key:1,"model-value":e.modelValue,controls:!1,"onUpdate:modelValue":o.emitChange},null,8,["model-value","onUpdate:modelValue"])):e.optionSetting.inputType==="textarea"?(n(),_(r,{key:2,type:"textarea",rows:1,"model-value":e.modelValue,"onUpdate:modelValue":o.emitChange},null,8,["model-value","onUpdate:modelValue"])):C("",!0)])}const ve=k(_e,[["render",pe],["__scopeId","data-v-c1e053d5"]]);const be={name:"InstallSelect",components:{OptionValueInput:ve},props:{modelValue:{},options:{},type:{default:"radio"}},data(){return{optionSettingData:{visible:!1}}},computed:{validOptions(){return this.options.filter(l=>l.value.trim()!==""&&l.label.trim()!=="")},currentOption(){return this.validOptions.find(l=>l.value===this.modelValue.value)},optionValues(){return this.validOptions.map(l=>l.value)},currenOptionSettings(){return this.currentOption==null?[]:this.currentOption.settings.map(l=>l.defaultValue)}},watch:{optionValues(){this.handleSelect(this.modelValue.value)},currenOptionSettings(){this.fillSettingValue()},modelValue:{immediate:!0,handler(){this.fillSettingValueFromModelValue()}}},methods:{handleSelect(l){const t=this.validOptions.find(d=>d.value===l);let e={value:null,settings:{}};if(t!=null){const d={};for(const i of t.settings)d[i.name]=i.defaultValue;e={value:l,settings:d}}this.$emit("update:modelValue",e),this.$emit("change",e),this.fillSettingValue()},fillSettingValue(){this.$nextTick(()=>{if(this.currentOption!=null)for(const l of this.currentOption.settings)l.value=l.defaultValue})},fillSettingValueFromModelValue(){for(const l in this.modelValue.settings){const t=this.options.find(d=>d.value===this.modelValue.value);if(t==null)continue;const e=t.settings.find(d=>d.name===l);e!=null&&(e.value=this.modelValue.settings[l])}}}},fe={key:0,class:"install-radio-select"},ye={key:1};function ge(l,t,e,d,i,o){const r=s("el-option"),v=s("el-select"),p=s("el-button"),g=s("OptionValueInput"),V=s("el-form-item"),u=s("el-form"),a=s("el-dialog");return e.options.length>0?(n(),c("div",fe,[y(v,{"model-value":e.modelValue.value,clearable:"",onChange:o.handleSelect},{default:b(()=>[(n(!0),c(S,null,F(o.validOptions,I=>(n(),_(r,{key:I.value,value:I.value,label:I.label},null,8,["value","label"]))),128))]),_:1},8,["model-value","onChange"]),o.currentOption!=null&&o.currentOption.settings.length>0?(n(),_(p,{key:0,type:"primary",icon:"Setting",class:"button-icon",onClick:t[0]||(t[0]=I=>i.optionSettingData.visible=!0)})):C("",!0),o.currentOption!=null?(n(),_(a,{key:1,modelValue:i.optionSettingData.visible,"onUpdate:modelValue":t[2]||(t[2]=I=>i.optionSettingData.visible=I),title:`${o.currentOption.label}${l.$t("service.settingsForSelectType")}`,"append-to-body":!0},{default:b(()=>[y(u,null,{default:b(()=>[(n(!0),c(S,null,F(o.currentOption.settings,I=>(n(),_(V,{key:I.name,label:I.label,required:I.required},{default:b(()=>[y(g,{modelValue:e.modelValue.settings[I.name],"onUpdate:modelValue":T=>e.modelValue.settings[I.name]=T,"option-setting":I,onInput:t[1]||(t[1]=T=>l.$emit("change"))},null,8,["modelValue","onUpdate:modelValue","option-setting"])]),_:2},1032,["label","required"]))),128))]),_:1})]),_:1},8,["modelValue","title"])):C("",!0)])):(n(),c("p",ye,"Please add options first."))}const A=k(be,[["render",ge],["__scopeId","data-v-f7bbb9b8"]]);const Ve={name:"InstallNumberInput",props:{type:{default:"text"}}};function Se(l,t,e,d,i,o){const r=s("el-input-number");return n(),_(r,{class:"install-number-input",controls:!1})}const H=k(Ve,[["render",Se],["__scopeId","data-v-6340b22c"]]),Ie={name:"Switch"};function ke(l,t,e,d,i,o){const r=s("el-switch");return n(),_(r)}const J=k(Ie,[["render",ke]]);const Ce={name:"TableFieldVariableInput",components:{InstallSwitch:J,InstallNumberInput:H,InstallSelect:A,InstallCheckbox:$,InstallRadio:E,InstallInput:W},props:{modelValue:{},variable:{required:!0}}};function Fe(l,t,e,d,i,o){const r=s("InstallInput"),v=s("InstallNumberInput"),p=s("InstallSelect"),g=s("InstallCheckbox"),V=s("InstallRadio"),u=s("InstallSwitch");return e.variable.inputType==="input"?(n(),_(r,{key:0,"model-value":e.modelValue,"onUpdate:modelValue":t[0]||(t[0]=a=>l.$emit("update:modelValue",a)),onInput:t[1]||(t[1]=a=>l.$emit("change",a))},null,8,["model-value"])):e.variable.inputType==="number_input"?(n(),_(v,{key:1,"model-value":e.modelValue,"onUpdate:modelValue":t[2]||(t[2]=a=>l.$emit("update:modelValue",a)),onInput:t[3]||(t[3]=a=>l.$emit("change",a))},null,8,["model-value"])):e.variable.inputType==="textarea"?(n(),_(r,{key:2,type:"textarea",rows:1,"model-value":e.modelValue,"onUpdate:modelValue":t[4]||(t[4]=a=>l.$emit("update:modelValue",a)),onInput:t[5]||(t[5]=a=>l.$emit("change",a))},null,8,["model-value"])):e.variable.inputType==="select"?(n(),_(p,{key:3,options:e.variable.options,"model-value":e.modelValue,"onUpdate:modelValue":t[6]||(t[6]=a=>l.$emit("update:modelValue",a)),onChange:t[7]||(t[7]=a=>l.$emit("change",a))},null,8,["options","model-value"])):e.variable.inputType==="checkbox"?(n(),_(g,{key:4,options:e.variable.options,"model-value":e.modelValue,"onUpdate:modelValue":t[8]||(t[8]=a=>l.$emit("update:modelValue",a)),onChange:t[9]||(t[9]=a=>l.$emit("change",a))},null,8,["options","model-value"])):e.variable.inputType==="radio"?(n(),_(V,{key:5,options:e.variable.options,"model-value":e.modelValue,"onUpdate:modelValue":t[10]||(t[10]=a=>l.$emit("update:modelValue",a)),onChange:t[11]||(t[11]=a=>l.$emit("change",a))},null,8,["options","model-value"])):e.variable.inputType==="switch"?(n(),_(u,{key:6,"model-value":e.modelValue,"onUpdate:modelValue":t[12]||(t[12]=a=>l.$emit("update:modelValue",a)),onChange:t[13]||(t[13]=a=>l.$emit("change",a))},null,8,["model-value"])):C("",!0)}const j=k(Ce,[["render",Fe],["__scopeId","data-v-f253c4c5"]]);function M(l){return l==null||l===""||l.trim&&l.trim()===""||JSON.stringify(l)==="[]"||JSON.stringify(l)==="{}"}function L(l){return l==="input"||l==="textarea"||l==="radio"?"":l==="select"?{value:null,settings:[]}:l==="checkbox"?[]:l==="table"||l==="database"||l==="query_model"?null:""}const we={name:"FieldSetting",components:{TableFieldVariableInput:j,MySqlFieldSelect:me},props:{valueKey:{default:"value"},table:{required:!0},group:{required:!0}},methods:{handleSelect(l){for(const t of l){t.origin==null&&(t.origin=JSON.parse(JSON.stringify(t)));for(const e of this.group.children)t[e.name]=M(t[e.name])?e.defaultValue:t[e.name],M(t[e.name])&&(t[e.name]=L(e.inputType))}this.group[this.valueKey]=l,this.emitChange()},emitChange(){this.$emit("change")},getColumnMinWidth(l){return l.inputType==="select"?"150px":"120px"}}},Te={key:0,class:"required"};function xe(l,t,e,d,i,o){const r=s("MySqlFieldSelect"),v=s("el-table-column"),p=s("TableFieldVariableInput"),g=s("el-table");return n(),c(S,null,[h("h5",null,f(e.group.label),1),y(r,{"onUpdate:modelValue":o.handleSelect,"model-value":e.group[e.valueKey],table:e.table,placeholder:"Select fields"},null,8,["onUpdate:modelValue","model-value","table"]),y(g,{size:"small",data:e.group[e.valueKey]},{default:b(()=>[y(v,{label:"字段名",width:"100px",prop:"name",fixed:""}),(n(!0),c(S,null,F(e.group.children,V=>(n(),_(v,{key:V.name,label:V.label,"min-width":o.getColumnMinWidth(V)},{header:b(()=>[V.required?(n(),c("em",Te,"*")):C("",!0),w(f(V.label),1)]),default:b(({row:u})=>[y(p,{variable:V,modelValue:u[V.name],"onUpdate:modelValue":a=>u[V.name]=a,onChange:o.emitChange},null,8,["variable","modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","min-width"]))),128))]),_:1},8,["data"])],64)}const Me=k(we,[["render",xe],["__scopeId","data-v-897a442e"]]);const Ke={name:"TableSelect",components:{FieldSetting:Me},props:{modelValue:{},valueKey:{default:"value"},variable:{required:!0}},data(){return{selected:null,databases:[],tables:[]}},computed:{...K(["currentProject","currentDatabase"]),fieldVariableGroup(){return this.variable.children||[]}},watch:{currentDatabase(){this.fetchTables()}},methods:{handleChange(l){this.selected=this.tables.find(t=>t.name===l),this.fieldVariableGroup.forEach(t=>{t[this.valueKey]=[]}),this.$emit("update:modelValue",l),this.$emit("change",l)},emitChange(){this.$emit("change")},fetchDatabases(){q().then(l=>{this.databases=l,this.fetchTables()}).catch(l=>{this.$tip.apiFailed(l)})},fetchTables(){const l=this.databases.find(t=>t.id===this.currentDatabase);if(l==null){this.tables=[];return}B({host:l.host,port:l.port,user:l.username,password:l.password,database:l.schema}).then(t=>{this.tables=t,this.modelValue!=null&&(this.selected=this.tables.find(e=>e.name===this.modelValue),this.selected==null&&this.handleChange(null))}).catch(t=>{this.$tip.apiFailed(t)})}},created(){this.fetchDatabases()}},Oe={class:"option-content"},Ue={class:"text-info-1"},qe={key:0,class:"field-settings"};function De(l,t,e,d,i,o){const r=s("el-option"),v=s("el-select"),p=s("FieldSetting");return n(),c(S,null,[y(v,{class:"table-select","popper-class":"table-select__popper","model-value":e.modelValue,clearable:"",onChange:o.handleChange},{default:b(()=>[(n(!0),c(S,null,F(i.tables,g=>(n(),_(r,{key:g.name,value:g.name,label:g.name},{default:b(()=>[h("p",Oe,[h("span",null,f(g.name),1),h("span",Ue,f(g.comment),1)])]),_:2},1032,["value","label"]))),128))]),_:1},8,["model-value","onChange"]),i.selected!=null&&o.fieldVariableGroup.length>0?(n(),c("ul",qe,[(n(!0),c(S,null,F(o.fieldVariableGroup,g=>(n(),c("li",{key:g.label},[y(p,{"value-key":e.valueKey,table:i.selected,group:g,onChange:o.emitChange},null,8,["value-key","table","group","onChange"])]))),128))])):C("",!0)],64)}const Qe=k(Ke,[["render",De],["__scopeId","data-v-624bbd32"]]);const Ne={name:"QueryModelFieldSelect",props:{modelValue:{},model:{required:!0},multiple:{default:!0}},data(){return{focused:!1,tables:[],selectedFields:[],currentHoverTable:null,currentHoverField:null,leaveFieldTimeout:null}},watch:{model:{immediate:!0,handler(){this.__handleTables()}},modelValue:{immediate:!0,handler(){this.selectedFields.splice(0,this.selectedFields.length),this.selectedFields.push.apply(this.selectedFields,this.__getSelectedFieldsObjects(this.modelValue))}}},methods:{focus(){this.focused=!0},handleFieldSorted(){this.$emit("update:modelValue",this.selectedFields.map(l=>`${l.table.id}.${l.name}`)),this.$emit("fields:change",this.selectedFields)},handleCheckAllChange(l,t){let e=[];t&&(e=l.fields.map(i=>`${l.id}.${i.name}`));let d=this.modelValue;d=d.filter(i=>!i.startsWith(`${l.id}.`)),d=d.concat(e),this.handleInput(l,d)},handleInput(l,t){const e=t.filter(i=>i.startsWith(`${l.id}.`));l.checkedAll=e.length===l.fields.length;let d=this.__getSelectedFieldsObjects(t);this.selectedFields.splice(0,this.selectedFields.length),this.selectedFields.push.apply(this.selectedFields,d),this.$emit("update:modelValue",t),this.$emit("fields:change",this.selectedFields)},handleFieldEnter(l){this.leaveFieldTimeout!=null&&clearTimeout(this.leaveFieldTimeout),this.currentHoverField=l},handleFieldLeave(){this.leaveFieldTimeout=setTimeout(()=>{this.currentHoverField=null},500)},handleTableEnter(l){this.currentHoverTable=l},handleTableLeave(){this.currentHoverTable=null},close(){this.focused=!1,this.handleTableLeave(),this.handleFieldLeave()},__handleTables(){this.tables=[];for(const l of this.model.tables){const t=l.fields.filter(e=>e.visible);t.length>0&&this.tables.push({id:l.id,type:l.type,name:l.name,alias:l.alias,fields:t,checkedAll:!1})}},__getSelectedFieldsObjects(l){return l.map(t=>{const e=t.split(".")[0],d=t.split(".")[1],i=this.model.tables.find(p=>p.id===e),o=i.fields.find(p=>p.name===d);if(o==null)return null;const r=JSON.parse(JSON.stringify(i)),v=JSON.parse(JSON.stringify(o));return delete r.fields,v.table=r,v}).filter(t=>t!=null)}}},G=l=>(O("data-v-738452e6"),l=l(),U(),l),$e={class:"model-field-select"},We={key:0,class:"placeholder"},Ee=["onMouseenter"],Ae=G(()=>h("em",null,"AS",-1)),He={key:0},Je={class:"field-select__tables"},je=["onMouseenter"],Le={class:"table__header"},Ge={class:"table__fields-wrap"},Be={class:"table-fields"},Re=G(()=>h("em",null,"AS",-1)),Pe={key:0,class:"text-info-1"};function ze(l,t,e,d,i,o){const r=s("el-checkbox"),v=s("el-checkbox-group"),p=s("el-scrollbar"),g=s("el-popover"),V=D("sortable");return n(),c("div",$e,[y(g,{trigger:"click","popper-class":"model-field-select-popper","hide-after":0,persistent:!1,onHide:o.close},{reference:b(()=>[Q((n(),c("ul",{class:x(["selected-preview",{"is-focus":i.focused}]),onClick:t[1]||(t[1]=(...u)=>o.focus&&o.focus(...u))},[i.selectedFields.length===0?(n(),c("li",We,"请选择")):(n(!0),c(S,{key:1},F(i.selectedFields,u=>(n(),c("li",{key:u.name,class:x({"field-light":i.currentHoverTable!=null&&u.table.id===i.currentHoverTable.id}),onMouseenter:a=>o.handleFieldEnter(u),onMouseleave:t[0]||(t[0]=(...a)=>o.handleFieldLeave&&o.handleFieldLeave(...a))},[h("p",null,[w(f(u.table.alias)+"."+f(u.name)+" ",1),u.alias!==u.name?(n(),c(S,{key:0},[Ae,w(),h("b",null,f(u.alias),1)],64)):C("",!0)]),u.comment!=null&&u.comment!==""?(n(),c("p",He,f(u.comment),1)):C("",!0)],42,Ee))),128))],2)),[[V,{data:i.selectedFields,onChange:o.handleFieldSorted},"config"]])]),default:b(()=>[h("div",Je,[(n(!0),c(S,null,F(i.tables,u=>(n(),c("div",{key:u.alias,class:x(["field-select__table",{"table-main":u.type==="MAIN","table-light":i.currentHoverField!=null&&u.id===i.currentHoverField.table.id}]),onMouseenter:a=>o.handleTableEnter(u),onMouseleave:t[2]||(t[2]=(...a)=>o.handleTableLeave&&o.handleTableLeave(...a))},[h("div",Le,[y(r,{modelValue:u.checkedAll,"onUpdate:modelValue":a=>u.checkedAll=a,onChange:a=>o.handleCheckAllChange(u,a)},{default:b(()=>[h("h4",null,f(u.name)+" AS "+f(u.alias),1)]),_:2},1032,["modelValue","onUpdate:modelValue","onChange"])]),h("div",Ge,[y(p,null,{default:b(()=>[h("div",Be,[y(v,{"model-value":e.modelValue,onChange:a=>o.handleInput(u,a)},{default:b(()=>[(n(!0),c(S,null,F(u.fields,a=>(n(),_(r,{label:`${u.id}.${a.name}`,key:a.name},{default:b(()=>[h("p",null,[w(f(a.name)+" ",1),a.alias!==a.name?(n(),c(S,{key:0},[Re,w(),h("b",null,f(a.alias),1)],64)):C("",!0)]),a.comment!==""?(n(),c("p",Pe,f(a.comment),1)):C("",!0)]),_:2},1032,["label"]))),128))]),_:2},1032,["model-value","onChange"])])]),_:2},1024)])],42,je))),128))])]),_:1},8,["onHide"])])}const Xe=k(Ne,[["render",ze],["__scopeId","data-v-738452e6"]]);const Ye={name:"QueryModelFieldSetting",components:{SortableButton:R,QueryModelFieldSelect:Xe,TableFieldVariableInput:j},props:{valueKey:{default:"value"},model:{required:!0},group:{required:!0}},data(){return{selectedFields:[]}},watch:{model(){this.initSelectedFields()}},methods:{handleSort(){this.initSelectedFields(),this.emitChange()},initSelectedFields(){this.selectedFields=[];const l=this.group[this.valueKey];l!=null&&l.length>0&&(this.selectedFields=l.map(t=>`${t.table.id}.${t.name}`))},handleSelect(l){const t=[];for(const e of l){e.origin==null&&(e.origin=JSON.parse(JSON.stringify(e)));for(const d of this.group.children)e[d.name]=M(e[d.name])?d.defaultValue:e[d.name],M(e[d.name])&&(e[d.name]=L(d.inputType));t.push(e)}this.group[this.valueKey].splice(0,this.group[this.valueKey].length),this.group[this.valueKey].push.apply(this.group[this.valueKey],t),this.emitChange()},emitChange(){this.$emit("change")},getColumnMinWidth(l){return l.inputType==="select"?"150px":"120px"}},created(){this.initSelectedFields()}},Ze=l=>(O("data-v-753b84cd"),l=l(),U(),l),el=Ze(()=>h("em",null,"AS",-1)),ll={key:0,class:"required"};function tl(l,t,e,d,i,o){const r=s("QueryModelFieldSelect"),v=s("SortableButton"),p=s("el-table-column"),g=s("TableFieldVariableInput"),V=s("el-table"),u=D("sortable");return n(),c(S,null,[h("h5",null,f(e.group.label),1),y(r,{modelValue:i.selectedFields,"onUpdate:modelValue":t[0]||(t[0]=a=>i.selectedFields=a),model:e.model,placeholder:"Select fields","onFields:change":o.handleSelect},null,8,["modelValue","model","onFields:change"]),e.group.children.length>0?Q((n(),_(V,{key:0,size:"small",data:e.group[e.valueKey],"row-key":a=>`${a.table.id}.${a.name}@${a.alias}`},{default:b(()=>[y(p,{width:"25px",fixed:""},{default:b(()=>[y(v)]),_:1}),y(p,{label:"字段名",width:"150px",prop:"name",fixed:""},{default:b(({row:a})=>[h("p",null,[w(f(a.table.alias)+"."+f(a.name)+" ",1),a.alias!==a.name?(n(),c(S,{key:0},[el,w(),h("b",null,f(a.alias),1)],64)):C("",!0)]),h("p",null,f(a.comment),1)]),_:1}),(n(!0),c(S,null,F(e.group.children,a=>(n(),_(p,{key:a.name,label:a.label,"min-width":o.getColumnMinWidth(a)},{header:b(()=>[a.required?(n(),c("em",ll,"*")):C("",!0),w(f(a.label),1)]),default:b(({row:I})=>[y(g,{variable:a,modelValue:I[a.name],"onUpdate:modelValue":T=>I[a.name]=T,onChange:o.emitChange},null,8,["variable","modelValue","onUpdate:modelValue","onChange"])]),_:2},1032,["label","min-width"]))),128))]),_:1},8,["data","row-key"])),[[u,{data:e.group[e.valueKey],onChange:o.handleSort},"config"]]):C("",!0)],64)}const nl=k(Ye,[["render",tl],["__scopeId","data-v-753b84cd"]]);const al={name:"QueryModelWindow",components:{DataSourceSelect:N,QueryModelView:P},data(){return{visible:!1}},computed:{...K(["currentDatabase"])},methods:{open(){this.visible=!0},close(){this.visible=!1,this.$emit("close")}}},ol=h("h2",null,"查询模型设计",-1),il={class:"header__opera"};function sl(l,t,e,d,i,o){const r=s("DataSourceSelect"),v=s("Close"),p=s("el-icon"),g=s("QueryModelView"),V=s("el-dialog");return n(),_(V,{"custom-class":"query-model-window",modelValue:i.visible,"onUpdate:modelValue":t[0]||(t[0]=u=>i.visible=u),fullscreen:"","append-to-body":"","show-close":!1},{header:b(()=>[ol,h("div",il,[y(r,{"model-value":l.currentDatabase},null,8,["model-value"]),y(p,{onClick:o.close},{default:b(()=>[y(v)]),_:1},8,["onClick"])])]),default:b(()=>[y(g)]),_:1},8,["modelValue"])}const ul=k(al,[["render",sl]]),dl="/images/database/icon-design.svg";const rl={name:"QueryModelSelect",components:{QueryModelWindow:ul,QueryModelFieldSetting:nl},props:{modelValue:{},valueKey:{default:"value"},variable:{required:!0}},data(){return{databases:[],models:[],selected:null}},computed:{...K(["currentProject","currentDatabase"]),fieldVariableGroup(){return this.variable.children||[]}},watch:{currentDatabase(){this.fetchModels()}},methods:{handleChange(l){this.selected=this.models.find(t=>t.id===l),this.fieldVariableGroup.forEach(t=>{t[this.valueKey]=[]}),this.$emit("update:modelValue",l),this.emitChange()},emitChange(){this.$emit("change")},fetchDatabases(){q().then(l=>{this.databases=l,this.fetchModels()}).catch(l=>{this.$tip.apiFailed(l)})},fetchModels(){const l=this.databases.find(t=>t.id===this.currentDatabase);if(l==null){this.models=[];return}this.models=l.models,this.modelValue!=null&&(this.selected=this.models.find(t=>t.id===this.modelValue),this.selected==null&&this.handleChange(null))}},created(){this.fetchDatabases()}},cl=l=>(O("data-v-0179f899"),l=l(),U(),l),ml={class:"query-model-select"},_l={class:"option-content"},hl={class:"text-info-1"},pl=cl(()=>h("img",{src:dl},null,-1)),vl={key:0,class:"field-settings"};function bl(l,t,e,d,i,o){const r=s("el-option"),v=s("el-select"),p=s("el-button"),g=s("QueryModelWindow"),V=s("QueryModelFieldSetting");return n(),c(S,null,[h("div",ml,[y(v,{class:"model-select","popper-class":"model-select__popper","model-value":e.modelValue,clearable:"",onChange:o.handleChange},{default:b(()=>[(n(!0),c(S,null,F(i.models,u=>(n(),_(r,{key:u.id,value:u.id,label:u.name},{default:b(()=>[h("p",_l,[h("span",null,f(u.name),1),h("span",hl,f(u.comment),1)])]),_:2},1032,["value","label"]))),128))]),_:1},8,["model-value","onChange"]),y(p,{class:"button-icon",type:"primary",onClick:t[0]||(t[0]=u=>l.$refs.queryModelWindow.open())},{default:b(()=>[pl]),_:1}),y(g,{ref:"queryModelWindow",onClose:o.fetchDatabases},null,8,["onClose"])]),i.selected!=null&&o.fieldVariableGroup.length>0?(n(),c("ul",vl,[(n(!0),c(S,null,F(o.fieldVariableGroup,u=>(n(),c("li",{key:u.label},[y(V,{"value-key":e.valueKey,model:i.selected,group:u,onChange:o.emitChange},null,8,["value-key","model","group","onChange"])]))),128))])):C("",!0)],64)}const fl=k(rl,[["render",bl],["__scopeId","data-v-0179f899"]]);const yl={name:"VariableInput",components:{InstallNumberInput:H,InstallSelect:A,DataSourceSelect:N,QueryModelSelect:fl,TableSelect:Qe,InstallCheckbox:$,InstallRadio:E,InstallInput:W,InstallSwitch:J},props:{variable:{required:!0},valueKey:{default:"value"}},computed:{inputType(){return this.variable.inputType}}},gl={class:"variable-input"};function Vl(l,t,e,d,i,o){const r=s("InstallInput"),v=s("InstallNumberInput"),p=s("InstallSelect"),g=s("InstallCheckbox"),V=s("InstallRadio"),u=s("InstallSwitch"),a=s("DataSourceSelect"),I=s("TableSelect"),T=s("QueryModelSelect");return n(),c("div",gl,[e.variable.inputType==="input"?(n(),_(r,{key:0,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[0]||(t[0]=m=>e.variable[e.valueKey]=m),onInput:t[1]||(t[1]=m=>l.$emit("change",m))},null,8,["modelValue"])):e.variable.inputType==="number_input"?(n(),_(v,{key:1,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[2]||(t[2]=m=>e.variable[e.valueKey]=m),onInput:t[3]||(t[3]=m=>l.$emit("change",m))},null,8,["modelValue"])):e.variable.inputType==="textarea"?(n(),_(r,{key:2,type:"textarea",modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[4]||(t[4]=m=>e.variable[e.valueKey]=m),onInput:t[5]||(t[5]=m=>l.$emit("change",m))},null,8,["modelValue"])):e.variable.inputType==="select"?(n(),_(p,{key:3,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[6]||(t[6]=m=>e.variable[e.valueKey]=m),options:e.variable.options,onChange:t[7]||(t[7]=m=>l.$emit("change",m))},null,8,["modelValue","options"])):e.variable.inputType==="checkbox"?(n(),_(g,{key:4,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[8]||(t[8]=m=>e.variable[e.valueKey]=m),options:e.variable.options,onChange:t[9]||(t[9]=m=>l.$emit("change",m))},null,8,["modelValue","options"])):e.variable.inputType==="radio"?(n(),_(V,{key:5,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[10]||(t[10]=m=>e.variable[e.valueKey]=m),options:e.variable.options,onChange:t[11]||(t[11]=m=>l.$emit("change",m))},null,8,["modelValue","options"])):e.variable.inputType==="switch"?(n(),_(u,{key:6,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[12]||(t[12]=m=>e.variable[e.valueKey]=m),onInput:t[13]||(t[13]=m=>l.$emit("change",m))},null,8,["modelValue"])):e.variable.inputType==="datasource"?(n(),_(a,{key:7,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[14]||(t[14]=m=>e.variable[e.valueKey]=m),"with-prefix":!1,"with-block":!0,onChange:t[15]||(t[15]=m=>l.$emit("change",m))},null,8,["modelValue"])):e.variable.inputType==="table"?(n(),_(I,{key:8,variable:e.variable,"value-key":e.valueKey,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[16]||(t[16]=m=>e.variable[e.valueKey]=m),onChange:t[17]||(t[17]=m=>l.$emit("change",m))},null,8,["variable","value-key","modelValue"])):e.variable.inputType==="query_model"?(n(),_(T,{key:9,variable:e.variable,"value-key":e.valueKey,modelValue:e.variable[e.valueKey],"onUpdate:modelValue":t[18]||(t[18]=m=>e.variable[e.valueKey]=m),onChange:t[19]||(t[19]=m=>l.$emit("change",m))},null,8,["variable","value-key","modelValue"])):C("",!0)])}const Ml=k(yl,[["render",Vl],["__scopeId","data-v-ea68e2f3"]]);const Sl={name:"ServiceCodeErrorWindow",data(){return{visible:!1,error:null}},methods:{open(l){this.error=l,this.visible=!0}}},Il={class:"window-header-wrap"},kl={class:"title"},Cl={class:"tip"},Fl={class:"window-content-wrap"};function wl(l,t,e,d,i,o){const r=s("CircleCloseFilled"),v=s("el-icon"),p=s("el-dialog");return n(),_(p,{modelValue:i.visible,"onUpdate:modelValue":t[0]||(t[0]=g=>i.visible=g),width:"1000px","custom-class":"service-code-error-window","show-close":!1},{header:b(()=>[h("div",Il,[h("div",kl,[y(v,null,{default:b(()=>[y(r)]),_:1}),h("h5",null,f(l.$t("service.serviceCodeErrorTitle")),1)]),h("p",Cl,f(l.$t("service.serviceCodeErrorTip")),1)])]),default:b(()=>[h("div",Fl,[h("p",null,"at "+f(i.error.position),1),h("pre",null,f(i.error.message),1)])]),_:1},8,["modelValue"])}const Kl=k(Sl,[["render",wl]]);export{Me as F,E as I,me as M,ve as O,Kl as S,Ml as V,W as a,$ as b,L as g,M as i};