← Back
Editing: index479.js
import{_ as e}from"./index103.js?v=VERSION_NUMBER";import{r as a,k as t,c as l,q as n,v as r,y as s,B as o,z as i,x as c,e as p,A as m,D as u}from"./base-lib.js?v=VERSION_NUMBER";import{_ as d}from"./index101.js?v=VERSION_NUMBER";import{n as v,L as f,b as h,p as _,K as y,fj as g,a7 as j,jC as w,A as b,e as x}from"./utils-lib.js?v=VERSION_NUMBER";import{u as k}from"./useStore4.js?v=VERSION_NUMBER";import{u as q}from"./column.js?v=VERSION_NUMBER";import{getPythonEnvInfo as C,PythonRequirementSetting as E,editPythonRequirement as P}from"./site.js?v=VERSION_NUMBER";import{f as V}from"./validator.js?v=VERSION_NUMBER";const I=h(),{siteInfo:A}=k(),D=a(),O=a(!1),S=a([]),M=t({pyVersion:"",path:"",search:""}),T=a(!1),B=()=>{T.value=!0,O.value=!0},L=async e=>{try{const t=await C({project_name:A.value.name,force:T.value?1:0,search:e.search});if(T.value=!1,!1===t.data.status)return I.error(t.data.msg),{data:[],total:0};M.pyVersion=t.data.python_version,M.path=t.data.requirement_path,S.value=(a=t.data.pip_source,Object.entries(a).map((([e,a])=>({label:e,key:a,value:e}))));let l=t.data.pip_list;return""!==e.search&&(l=l.filter((a=>a.name.includes(e.search)))),{data:l,total:l.length}}catch(t){return{data:[],total:0}}var a},z=e=>{D.value=e||null,v({area:75,isAsync:!0,title:"安装第三方库",btn:"安装",component:()=>f((()=>import("./install-package.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url),compData:{row:e,path:M.path,project_name:A.value.name,pipSource:S.value,refreshEvent:()=>{}}})},R=async e=>{await _({title:"卸载第三方库",icon:"warning-filled",content:"是否卸载第三方库【".concat(e.name,"】?")});(await y({loading:"正在卸载,请稍后...",request:E({project_name:A.value.name,package_name:e.name,active:"uninstall"}),message:!0})).status&&(O.value=!0)},H=()=>{V({type:"file",path:M.path,change:e=>{(async e=>{(await y({loading:"正在修改,请稍后...",request:P({project_name:A.value.name,requirement_path:e}),message:!0})).status&&(O.value=!0)})(e)}})},K=a(),U=t({type:"common",name:"",version:"",file:"",pip:""}),F=t({name:[{validator:(e,a,t)=>{"common"===U.type?a?t():t(new Error("请输入名称")):t()}}],file:[{validator:(e,a,t)=>{"file"===U.type?a?t():t(new Error("请选择记录文件")):t()}}]}),G=()=>{V({type:"file",path:U.file,change:e=>{U.file=e}})},J=async()=>{var e,a;U.name=(null==(e=D.value)?void 0:e.name)||"",U.file=M.path||"",U.pip=(null==(a=S.value[0])?void 0:a.label)||""},N=async e=>{try{await K.value.validate();const a="file"===U.type;let t={project_name:A.value.name,pip_source:U.pip};t=a?{...t,requirement_path:U.file}:{...t,package_name:U.name,package_version:U.version,active:"install"},v({title:"正在安装,请耐心等候...",area:52,component:()=>f((()=>import("./log2.js?v=VERSION_NUMBER")),__vite__mapDeps([]),import.meta.url),compData:{type:"createPythonProject",logPath:"/www/server/python_project//vhost/logs/pip_".concat(t.project_name,".log"),endMsg:"安装结束",failMsg:"环境准备失败",successMsg:"安装结束",isClear:!0,completeEvent:(e,a)=>{O.value=!0,a()}}}),e();const l=await E(t);I.request(l)}catch(a){}},Q={class:"grid grid-cols-1 gap-y-[1rem]"},W={class:"flex flex-col leading-[2rem]"},X={class:"flex items-center"},Y={class:"flex items-center"},Z={class:"h-[45rem] mt-[2rem]"},$=x(l({__name:"index",setup(a){const{siteInfo:t}=k(),{BtTable:l,BtSearch:v}=g({request:L,columns:[{label:"名称",prop:"name"},{label:"版本",prop:"version"},{label:"依赖记录文件中的版本",prop:"requirement"},q([{onClick:z,title:"安装",render:e=>{let a="--"===e.version;return a=a&&!e.requirement.includes("git")&&!e.requirement.includes("file"),a?p("span",{class:"text-primary cursor-pointer hover:text-[#1d9534]",onClick:()=>z(e)},[o("安装")]):""}},{onClick:R,isHide:e=>"--"===e.version,title:"卸载"}])],extension:[j(O),w()]});return(a,f)=>{const h=d,_=u,y=e;return n(),r("div",null,[s("div",Q,[s("div",null,[f[3]||(f[3]=o(" Python版本 ")),s("span",null,i(c(M).pyVersion),1)]),s("div",W,[f[5]||(f[5]=s("span",null,"命令行使用项目中的环境:",-1)),f[6]||(f[6]=s("span",null,[o("命令行可使用 "),s("code",null,"source py-project-env [项目名称]"),o(" 进入该项目虚拟环境,退出时使用"),s("code",null,"deactivate")],-1)),s("span",X,[f[4]||(f[4]=o(" 示例:")),s("code",null,"source py-project-env "+i(c(t).name),1),s("i",{class:"svgtofont-el-document-copy cursor-pointer text-[#333] text-[1.5rem] copy ml-[4px]",title:"复制启动命令",onClick:f[0]||(f[0]=()=>c(b)({value:"source py-project-env ".concat(c(t).name)}))})]),f[7]||(f[7]=s("span",null,"若提示没有py-project-env文件,可尝试关闭系统加固并重启面板,然后进入Python项目页面此,时会自动设置该文件",-1))]),s("div",Y,[f[8]||(f[8]=s("span",{class:"mr-[1rem] whitespace-nowrap"},"依赖记录文件",-1)),p(h,{modelValue:c(M).path,"onUpdate:modelValue":f[1]||(f[1]=e=>c(M).path=e),icon:"el-folder-opened",onIconClick:c(H),width:"40rem"},null,8,["modelValue","onIconClick"])])]),s("div",Z,[p(y,null,{"header-left":m((()=>[p(_,{type:"primary",onClick:f[2]||(f[2]=e=>c(z)())},{default:m((()=>f[9]||(f[9]=[o("安装")]))),_:1})])),"header-right":m((()=>[p(c(v),{width:"20rem",placeholder:"搜索第三方库"}),p(_,{type:"default",class:"!ml-[1rem]",onClick:c(B)},{default:m((()=>f[10]||(f[10]=[o("强制刷新")]))),_:1},8,["onClick"])])),content:m((()=>[p(c(l),{"max-height":480})])),_:1})])])}}}),[["__scopeId","data-v-3f4f39a5"]]),ee=Object.freeze(Object.defineProperty({__proto__:null,default:$},Symbol.toStringTag,{value:"Module"}));export{G as a,K as b,ee as c,J as g,U as i,N as o,S as p,F as r}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel