/*! Build based on gin-vue-admin Time : 1757946830000 */ !function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n3?(a=m===r)&&(l=u[(o=u[4])?5:(o=3,3)],u[4]=u[5]=e):u[0]<=d&&((a=n<2&&dr||r>m)&&(u[4]=n,u[5]=r,s.n=m,o=0))}if(a||n>1)return i;throw p=!0,r}return function(a,f,m){if(c>1)throw TypeError("Generator is already running");for(p&&1===f&&d(f,m),o=f,l=m;(t=o<2?e:l)||!p;){u||(o?o<3?(o>1&&(s.n=-1),d(o,l)):s.n=l:s.v=l);try{if(c=2,u){if(o||(a="next"),t=u[a]){if(!(t=t.call(u,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=u.return)&&t.call(u),o<2&&(l=TypeError("The iterator does not provide a '"+a+"' method"),o=1);u=e}else if((t=(p=s.n<0)?l:n.call(r,s))!==i)break}catch(t){u=e,o=1,l=t}finally{c=1}}return{value:t,done:p}}}(n,a,u),!0),f}var i={};function c(){}function f(){}function p(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(o(t={},r,function(){return this}),t),d=p.prototype=c.prototype=Object.create(s);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,o(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return f.prototype=p,o(d,"constructor",p),o(p,"constructor",f),f.displayName="GeneratorFunction",o(p,a,"GeneratorFunction"),o(d),o(d,a,"Generator"),o(d,r,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(u=function(){return{w:l,m:m}})()}function o(e,t,n,r){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}o=function(e,t,n,r){function u(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?a?a(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(u("next",0),u("throw",1),u("return",2))},o(e,t,n,r)}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,u,o,l=[],i=!0,c=!1;try{if(u=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;i=!1}else for(;!(i=(r=u.call(n)).done)&&(l.push(r.value),l.length!==t);i=!0);}catch(e){c=!0,a=e}finally{try{if(!i&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return l}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&ee.value--,be());case 2:return e.a(2)}},e)})));case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),_e=function(){var e=p(u().m(function e(){return u().w(function(e){for(;;)switch(e.n){case 0:N.confirm("确定要刷新缓存吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(p(u().m(function e(){var t;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,h();case 1:0===(t=e.v).code&&C({type:"success",message:t.msg});case 2:return e.a(2)}},e)})));case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),Ae=T({newApis:[],deleteApis:[],ignoreApis:[]}),ke=T(!1),Ie=function(){var e=p(u().m(function e(){var t;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,y();case 1:0===(t=e.v).code&&(t.data.newApis.forEach(function(e){e.apiGroup=oe.value[e.path.split("/")[1]]}),Ae.value=t.data,ke.value=!0);case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),xe=T(null),je=T("新增Api"),Ce=T(!1),Oe=function(e){switch(e){case"addApi":je.value="新增Api";break;case"edit":je.value="编辑Api"}P.value=e,Ce.value=!0},Se=function(){xe.value.resetFields(),_.value={path:"",apiGroup:"",method:"",description:""},Ce.value=!1},Ve=function(){var e=p(u().m(function e(t){var n;return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,i({id:t.ID});case 1:n=e.v,_.value=n.data.api,Oe("edit");case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),Pe=function(){var e=p(u().m(function e(){return u().w(function(e){for(;;)switch(e.n){case 0:xe.value.validate(function(){var e=p(u().m(function e(t){var n;return u().w(function(e){for(;;)switch(e.n){case 0:if(!t){e.n=6;break}n=P.value,e.n="addApi"===n?1:"edit"===n?3:5;break;case 1:return e.n=2,f(_.value);case 2:return 0===e.v.code&&C({type:"success",message:"添加成功",showClose:!0}),be(),le(),Se(),e.a(3,6);case 3:return e.n=4,m(_.value);case 4:return 0===e.v.code&&C({type:"success",message:"编辑成功",showClose:!0}),be(),Se(),e.a(3,6);case 5:return C({type:"error",message:"未知操作",showClose:!0}),e.a(3,6);case 6:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}());case 1:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),Ge=function(){var e=p(u().m(function e(t){return u().w(function(e){for(;;)switch(e.n){case 0:N.confirm("此操作将永久删除所有角色下该api, 是否继续?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(p(u().m(function e(){return u().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,c(t);case 1:0===e.v.code&&(C({type:"success",message:"删除成功!"}),1===re.value.length&&ee.value>1&&ee.value--,be(),le());case 2:return e.a(2)}},e)})));case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),Te=T(!1),Ee=function(){var e=p(u().m(function e(){var t,n,r;return u().w(function(e){for(;;)switch(e.n){case 0:return Te.value=!0,t=Ae.value.newApis.filter(function(e){return!e.apiGroup||!e.description}).map(function(e){return e.path}),e.n=1,M({data:t,command:"apiCompletion"});case 1:if(n=e.v,Te.value=!1,0===n.code)try{r=JSON.parse(n.data),Ae.value.newApis.forEach(function(e){var t=r.find(function(t){return t.path===e.path});t&&(e.apiGroup||(e.apiGroup=t.apiGroup),e.description||(e.description=t.description))})}catch(a){C({type:"error",message:"AI自动填充失败,请重新生成"})}case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();return function(e,n){var r=A("el-input"),u=A("el-form-item"),o=A("el-option"),i=A("el-select"),c=A("el-button"),f=A("el-form"),p=A("el-table-column"),s=A("el-table"),d=A("el-pagination"),m=A("ai-gva"),v=A("el-icon"),h=A("el-drawer"),y=E("loading");return I(),U("div",null,[D("div",W,[S(f,{ref:"searchForm",inline:!0,model:ae.value},{default:x(function(){return[S(u,{label:"路径"},{default:x(function(){return[S(r,{modelValue:ae.value.path,"onUpdate:modelValue":n[0]||(n[0]=function(e){return ae.value.path=e}),placeholder:"路径"},null,8,["modelValue"])]}),_:1}),S(u,{label:"描述"},{default:x(function(){return[S(r,{modelValue:ae.value.description,"onUpdate:modelValue":n[1]||(n[1]=function(e){return ae.value.description=e}),placeholder:"描述"},null,8,["modelValue"])]}),_:1}),S(u,{label:"API分组"},{default:x(function(){return[S(i,{modelValue:ae.value.apiGroup,"onUpdate:modelValue":n[2]||(n[2]=function(e){return ae.value.apiGroup=e}),clearable:"",placeholder:"请选择"},{default:x(function(){return[(I(!0),U(z,null,B(ue.value,function(e){return I(),k(o,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])}),128))]}),_:1},8,["modelValue"])]}),_:1}),S(u,{label:"请求"},{default:x(function(){return[S(i,{modelValue:ae.value.method,"onUpdate:modelValue":n[3]||(n[3]=function(e){return ae.value.method=e}),clearable:"",placeholder:"请选择"},{default:x(function(){return[(I(!0),U(z,null,B(O.value,function(e){return I(),k(o,{key:e.value,label:"".concat(e.label,"(").concat(e.value,")"),value:e.value},null,8,["label","value"])}),128))]}),_:1},8,["modelValue"])]}),_:1}),S(u,null,{default:x(function(){return[S(c,{type:"primary",icon:"search",onClick:me},{default:x(function(){return a(n[11]||(n[11]=[j(" 查询 ",-1)]))}),_:1}),S(c,{icon:"refresh",onClick:de},{default:x(function(){return a(n[12]||(n[12]=[j(" 重置 ",-1)]))}),_:1})]}),_:1})]}),_:1},8,["model"])]),D("div",H,[D("div",K,[S(c,{type:"primary",icon:"plus",onClick:n[4]||(n[4]=function(e){return Oe("addApi")})},{default:x(function(){return a(n[13]||(n[13]=[j(" 新增 ",-1)]))}),_:1}),S(c,{icon:"delete",disabled:!w.value.length,onClick:we},{default:x(function(){return a(n[14]||(n[14]=[j(" 删除 ",-1)]))}),_:1},8,["disabled"]),S(c,{icon:"Refresh",onClick:_e},{default:x(function(){return a(n[15]||(n[15]=[j(" 刷新缓存 ",-1)]))}),_:1}),S(c,{icon:"Compass",onClick:Ie},{default:x(function(){return a(n[16]||(n[16]=[j(" 同步API ",-1)]))}),_:1}),S(R,{"template-id":"api"}),S(J,{"template-id":"api",limit:9999}),S($,{"template-id":"api",onOnSuccess:be})]),S(s,{data:re.value,onSortChange:ye,onSelectionChange:ge},{default:x(function(){return[S(p,{type:"selection",width:"55"}),S(p,{align:"left",label:"id","min-width":"60",prop:"ID",sortable:"custom"}),S(p,{align:"left",label:"API路径","min-width":"150",prop:"path",sortable:"custom"}),S(p,{align:"left",label:"API分组","min-width":"150",prop:"apiGroup",sortable:"custom"}),S(p,{align:"left",label:"API简介","min-width":"150",prop:"description",sortable:"custom"}),S(p,{align:"left",label:"请求","min-width":"150",prop:"method",sortable:"custom"},{default:x(function(e){return[D("div",null,F(e.row.method)+" / "+F(l(e.row.method)),1)]}),_:1}),S(p,{align:"left",fixed:"right",label:"操作","min-width":V(t).operateMinWith},{default:x(function(e){return[S(c,{icon:"edit",type:"primary",link:"",onClick:function(t){return Ve(e.row)}},{default:x(function(){return a(n[17]||(n[17]=[j(" 编辑 ",-1)]))}),_:1},8,["onClick"]),S(c,{icon:"delete",type:"primary",link:"",onClick:function(t){return Ge(e.row)}},{default:x(function(){return a(n[18]||(n[18]=[j(" 删除 ",-1)]))}),_:1},8,["onClick"])]}),_:1},8,["min-width"])]}),_:1},8,["data"]),D("div",L,[S(d,{"current-page":ee.value,"page-size":ne.value,"page-sizes":[10,30,50,100],total:te.value,layout:"total, sizes, prev, pager, next, jumper",onCurrentChange:he,onSizeChange:ve},null,8,["current-page","page-size","total"])])]),S(h,{modelValue:ke.value,"onUpdate:modelValue":n[5]||(n[5]=function(e){return ke.value=e}),size:V(t).drawerSize,"before-close":fe,"show-close":!1},{header:x(function(){return[D("div",Q,[n[21]||(n[21]=D("span",{class:"text-lg"},"同步路由",-1)),D("div",null,[S(c,{loading:Te.value,onClick:fe},{default:x(function(){return a(n[19]||(n[19]=[j(" 取 消 ",-1)]))}),_:1},8,["loading"]),S(c,{type:"primary",loading:pe.value||Te.value,onClick:se},{default:x(function(){return a(n[20]||(n[20]=[j(" 确 定 ",-1)]))}),_:1},8,["loading"])])])]}),default:x(function(){return[S(g,{title:"同步API,不输入路由分组将不会被自动同步,如果api不需要参与鉴权,可以按忽略按钮进行忽略。"}),D("h4",null,[n[23]||(n[23]=j(" 新增路由 ",-1)),n[24]||(n[24]=D("span",{class:"text-xs text-gray-500 mx-2 font-normal"},"存在于当前路由中,但是不存在于api表",-1)),S(c,{type:"primary",size:"small",onClick:Ee},{default:x(function(){return[S(v,{size:"18"},{default:x(function(){return[S(m)]}),_:1}),n[22]||(n[22]=j(" 自动填充 ",-1))]}),_:1})]),q((I(),k(s,{"element-loading-text":"小淼正在思考...",data:Ae.value.newApis},{default:x(function(){return[S(p,{align:"left",label:"API路径","min-width":"150",prop:"path"}),S(p,{align:"left",label:"API分组","min-width":"150",prop:"apiGroup"},{default:x(function(e){var t=e.row;return[S(i,{modelValue:t.apiGroup,"onUpdate:modelValue":function(e){return t.apiGroup=e},placeholder:"请选择或新增","allow-create":"",filterable:"","default-first-option":""},{default:x(function(){return[(I(!0),U(z,null,B(ue.value,function(e){return I(),k(o,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])}),128))]}),_:1},8,["modelValue","onUpdate:modelValue"])]}),_:1}),S(p,{align:"left",label:"API简介","min-width":"150",prop:"description"},{default:x(function(e){var t=e.row;return[S(r,{modelValue:t.description,"onUpdate:modelValue":function(e){return t.description=e},autocomplete:"off"},null,8,["modelValue","onUpdate:modelValue"])]}),_:1}),S(p,{align:"left",label:"请求","min-width":"150",prop:"method"},{default:x(function(e){return[D("div",null,F(e.row.method)+" / "+F(l(e.row.method)),1)]}),_:1}),S(p,{label:"操作","min-width":"150",fixed:"right"},{default:x(function(e){var t=e.row;return[S(c,{icon:"plus",type:"primary",link:"",onClick:function(e){return ce(t)}},{default:x(function(){return a(n[25]||(n[25]=[j(" 单条新增 ",-1)]))}),_:1},8,["onClick"]),S(c,{icon:"sunrise",type:"primary",link:"",onClick:function(e){return ie(t,!0)}},{default:x(function(){return a(n[26]||(n[26]=[j(" 忽略 ",-1)]))}),_:1},8,["onClick"])]}),_:1})]}),_:1},8,["data"])),[[y,pe.value||Te.value]]),n[28]||(n[28]=D("h4",null,[j(" 已删除路由 "),D("span",{class:"text-xs text-gray-500 ml-2 font-normal"},"已经不存在于当前项目的路由中,确定同步后会自动从apis表删除")],-1)),S(s,{data:Ae.value.deleteApis},{default:x(function(){return[S(p,{align:"left",label:"API路径","min-width":"150",prop:"path"}),S(p,{align:"left",label:"API分组","min-width":"150",prop:"apiGroup"}),S(p,{align:"left",label:"API简介","min-width":"150",prop:"description"}),S(p,{align:"left",label:"请求","min-width":"150",prop:"method"},{default:x(function(e){return[D("div",null,F(e.row.method)+" / "+F(l(e.row.method)),1)]}),_:1})]}),_:1},8,["data"]),n[29]||(n[29]=D("h4",null,[j(" 忽略路由 "),D("span",{class:"text-xs text-gray-500 ml-2 font-normal"},"忽略路由不参与api同步,常见为不需要进行鉴权行为的路由")],-1)),S(s,{data:Ae.value.ignoreApis},{default:x(function(){return[S(p,{align:"left",label:"API路径","min-width":"150",prop:"path"}),S(p,{align:"left",label:"API分组","min-width":"150",prop:"apiGroup"}),S(p,{align:"left",label:"API简介","min-width":"150",prop:"description"}),S(p,{align:"left",label:"请求","min-width":"150",prop:"method"},{default:x(function(e){return[D("div",null,F(e.row.method)+" / "+F(l(e.row.method)),1)]}),_:1}),S(p,{label:"操作","min-width":"150",fixed:"right"},{default:x(function(e){var t=e.row;return[S(c,{icon:"sunny",type:"primary",link:"",onClick:function(e){return ie(t,!1)}},{default:x(function(){return a(n[27]||(n[27]=[j(" 取消忽略 ",-1)]))}),_:1},8,["onClick"])]}),_:1})]}),_:1},8,["data"])]}),_:1},8,["modelValue","size"]),S(h,{modelValue:Ce.value,"onUpdate:modelValue":n[10]||(n[10]=function(e){return Ce.value=e}),size:V(t).drawerSize,"before-close":Se,"show-close":!1},{header:x(function(){return[D("div",X,[D("span",Y,F(je.value),1),D("div",null,[S(c,{onClick:Se},{default:x(function(){return a(n[30]||(n[30]=[j(" 取 消 ",-1)]))}),_:1}),S(c,{type:"primary",onClick:Pe},{default:x(function(){return a(n[31]||(n[31]=[j(" 确 定 ",-1)]))}),_:1})])])]}),default:x(function(){return[S(g,{title:"新增API,需要在角色管理内配置权限才可使用"}),S(f,{ref_key:"apiForm",ref:xe,model:_.value,rules:Z.value,"label-width":"80px"},{default:x(function(){return[S(u,{label:"路径",prop:"path"},{default:x(function(){return[S(r,{modelValue:_.value.path,"onUpdate:modelValue":n[6]||(n[6]=function(e){return _.value.path=e}),autocomplete:"off"},null,8,["modelValue"])]}),_:1}),S(u,{label:"请求",prop:"method"},{default:x(function(){return[S(i,{modelValue:_.value.method,"onUpdate:modelValue":n[7]||(n[7]=function(e){return _.value.method=e}),placeholder:"请选择",style:{width:"100%"}},{default:x(function(){return[(I(!0),U(z,null,B(O.value,function(e){return I(),k(o,{key:e.value,label:"".concat(e.label,"(").concat(e.value,")"),value:e.value},null,8,["label","value"])}),128))]}),_:1},8,["modelValue"])]}),_:1}),S(u,{label:"api分组",prop:"apiGroup"},{default:x(function(){return[S(i,{modelValue:_.value.apiGroup,"onUpdate:modelValue":n[8]||(n[8]=function(e){return _.value.apiGroup=e}),placeholder:"请选择或新增","allow-create":"",filterable:"","default-first-option":""},{default:x(function(){return[(I(!0),U(z,null,B(ue.value,function(e){return I(),k(o,{key:e.value,label:e.label,value:e.value},null,8,["label","value"])}),128))]}),_:1},8,["modelValue"])]}),_:1}),S(u,{label:"api简介",prop:"description"},{default:x(function(){return[S(r,{modelValue:_.value.description,"onUpdate:modelValue":n[9]||(n[9]=function(e){return _.value.description=e}),autocomplete:"off"},null,8,["modelValue"])]}),_:1})]}),_:1},8,["model","rules"])]}),_:1},8,["modelValue","size"])])}}});e("default",P(Z,[["__scopeId","data-v-cab82374"]]))}}})}();