import{D as d,U as m,A as p,b as h,c as f}from"./api.HqQpaxQG.js";import{W as w,F as y,E as o,$ as g}from"./index.CL7yl-Wb.js";import{aH as v,S as r,aj as x}from"./vue.D1BjjNmv.js";const z=function({crudExpose:s}){v();const l=async e=>await h(e),i=async({form:e,row:t})=>(e.id=t.id,await m(e)),n=async({row:e})=>await d(e.id),c=async({form:e})=>await p(e),u=async e=>{try{y.confirm("确定要生成预览视频吗？","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"info"}).then(async()=>{const t=o({message:"正在生成预览视频，请稍候...",type:"info",duration:0});try{const a=await f({digital_human_id:e.id,text:"您好，我是您的数字人助手，很高兴为您服务！"});t.close(),console.log(a),a.code===2e3?(o.success("数字人演示视频生成任务已提交！"),s.doRefresh()):o.error(a.msg||"生成预览视频失败")}catch(a){t.close(),o.error("生成预览视频失败，请稍后重试"),console.error("生成预览视频错误:",a)}}).catch(()=>{})}catch(t){console.error("生成预览视频错误:",t)}};return{crudOptions:{toolbar:{buttons:{search:{show:!1},refresh:{show:!1},compact:{show:!1},export:{text:"导出",type:"primary",size:"small",icon:"upload",circle:!1,display:!0,show:!1},columns:{show:!1}}},request:{pageRequest:l,addRequest:c,editRequest:i,delRequest:n},actionbar:{buttons:{add:{show:!0,size:"small",click:()=>{s&&typeof s.openAdd=="function"&&s.openAdd()}}}},rowHandle:{fixed:"right",width:350,buttons:{generatePreview:{text:"生成预览视频",size:"small",type:"text",show:!0,click:({row:e})=>{u(e)}},view:{iconRight:"view",show:!1,type:"text",click:({row:e})=>{}},edit:{iconRight:"Edit",type:"text",show:!1},remove:{iconRight:"Delete",type:"text",show:!1}}},pagination:{show:!0},table:{rowKey:"id"},search:{show:!0,layout:"auto",autoSearch:!1,buttons:{search:{size:"small"},reset:{size:"small"}}},columns:{_index:{title:"序号",form:{show:!1},column:{type:"index",align:"center",width:"70px",columnSetDisabled:!0}},name:{title:"数字人名称",search:{show:!0,component:{placeholder:"请输入数字人名称"},size:"small",col:{span:3}},type:"input",column:{minWidth:150},form:{rules:[{required:!0,message:"数字人名称为必填项"}]}},avatar_url:{title:"头像",type:"cropper-uploader",form:{component:{uploader:{action:"/api/system/admin_upload/",multiple:!1,limit:1,accept:".jpg,.png,.jpeg",headers:()=>({Authorization:`JWT ${localStorage.getItem("token")||""}`}),data:{tenant_id:"1"},onSuccessHandle(e){return e.data.url},beforeUpload(e){const t=e.type.startsWith("image/"),a=e.size/1024/1024<2;return t?a?!0:(this.$message.error("图片大小不能超过 2MB!"),!1):(this.$message.error("只能上传图片文件!"),!1)}},slots:{default:({modelValue:e})=>e?r("img",{src:e,class:"avatar",style:"width:100px;height:100px;"},null):r(x("el-icon"),{class:"avatar-uploader-icon"},{default:()=>[r(g,null,null)]})}},rules:[{required:!0,message:"请上传头像"}]}},template_video_url:{title:"模板视频",type:"file-uploader",form:{component:{uploader:{action:"/api/system/admin_upload/",multiple:!1,limit:1,accept:".mp4,.mov,.avi",headers:()=>({Authorization:`JWT ${localStorage.getItem("token")||""}`}),data:{tenant_id:"1"},onSuccessHandle(e){return e.data.url},beforeUpload(e){const t=e.type.startsWith("video/"),a=e.size/1024/1024<50;return t?a?!0:(this.$message.error("视频大小不能超过 50MB!"),!1):(this.$message.error("只能上传视频文件!"),!1)}},placeholder:"请上传模板视频"}},column:{show:!1,minWidth:180}},demo_video_url:{title:"演示视频",type:"file-uploader",column:{width:300},form:{show:!1}},status:{title:"状态",search:{show:!0,component:{placeholder:"请选择状态"},size:"small",col:{span:3}},type:"dict-select",column:{minWidth:100},dict:w({data:[{value:1,label:"启用"},{value:0,label:"禁用"}]})},description:{title:"描述",search:{show:!1,size:"small",col:{span:3}},type:"textarea",column:{minWidth:200,showOverflowTooltip:!0},form:{component:{span:24}}},creator_name:{title:"创建人",type:"text",column:{minWidth:120},form:{show:!1}},create_datetime:{title:"创建时间",type:"datetime",column:{show:!1,minWidth:160},form:{show:!1}},update_datetime:{title:"更新时间",type:"datetime",column:{show:!1,minWidth:160},form:{show:!1}}}}}};export{z as createCrudOptions};
