var q=Object.defineProperty,P=Object.defineProperties;var V=Object.getOwnPropertyDescriptors;var U=Object.getOwnPropertySymbols;var z=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable;var C=(o,n,e)=>n in o?q(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,f=(o,n)=>{for(var e in n||(n={}))z.call(n,e)&&C(o,e,n[e]);if(U)for(var e of U(n))B.call(n,e)&&C(o,e,n[e]);return o},S=(o,n)=>P(o,V(n));var p=(o,n,e)=>new Promise((i,l)=>{var c=u=>{try{d(e.next(u))}catch(r){l(r)}},g=u=>{try{d(e.throw(u))}catch(r){l(r)}},d=u=>u.done?i(u.value):Promise.resolve(u.value).then(c,g);d((e=e.apply(o,n)).next())});import{P as E}from"./index.70371ae0.js";import{S as K}from"./index.b24e8dc3.js";import{h as A,i as O,c as G,j as H}from"./api.32da9f90.js";import{g as R}from"./filters.de6e9e5f.js";import{C as w}from"./constant.ded25e36.js";import{g as L}from"./objectUtil.ec24ceed.js";import{U as D}from"./index.06e28872.js";import{d as x,a as M,r as k,u as I,B as j,i as t,q as $,l as s,_ as v,ce as _,a9 as y,p as m,k as h,ai as J,cf as W,H as b,cg as Q,aa as X,ae as Y,ch as Z,bC as F}from"./index.789dd106.js";import{f as ee}from"./dateUtil.862a46f3.js";import"./searchs.b637f0d6.js";import"./dayjs.min.61ba4767.js";const ae="_instrumentSave_1gfcu_1",te="_updateFile_1gfcu_5",N={instrumentSave:ae,updateFile:te},le=x({name:"role-operation",props:{type:{type:String,default:"add"},data:{type:Object,default:()=>{}}},emits:["close","getList"],setup(o,{slots:n,attrs:e,emit:i}){const l=M({name:null,defaultScore:null,code:null,transferFlag:!0,img:null,media:null}),c=k(!1),g=k(),d=I(),u=()=>p(this,null,function*(){g.value.validate(r=>p(this,null,function*(){if(r)return!1;try{c.value=!0,l.code&&(l.code=l.code.replace(/[,]/g,",")),o.type==="add"?(yield A(S(f({},l),{defaultScore:l.transferFlag?l.defaultScore:"STAVE"})),d.success("\u6DFB\u52A0\u6210\u529F")):o.type==="edit"&&(yield O(S(f({},l),{defaultScore:l.transferFlag?l.defaultScore:"STAVE",id:o.data.id})),d.success("\u4FEE\u6539\u6210\u529F")),i("close"),i("getList")}catch(a){}c.value=!1}))});return j(()=>p(this,null,function*(){if(o.type==="edit"){const r=o.data;l.name=r.name,l.defaultScore=r.defaultScore,l.code=r.code,l.transferFlag=r.transferFlag,l.img=r.img,l.media=r.media}})),()=>t("div",{class:N.instrumentSave},[t($,{model:l,ref:g,"label-placement":"left","label-width":"100px"},{default:()=>[t(s,{label:"\u4E50\u5668\u540D\u79F0",path:"name",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0"}]},{default:()=>[t(v,{value:l.name,"onUpdate:value":r=>l.name=r,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0",clearable:!0,maxlength:10,showCount:!0},null)]}),t(s,{label:"\u652F\u6301\u8F6C\u7B80\u8C31",path:"transferFlag",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u652F\u6301\u8F6C\u7B80\u8C31",trigger:["input","blur"],type:"boolean"}]},{default:()=>[t(_,{value:l.transferFlag,"onUpdate:value":r=>l.transferFlag=r,options:[{label:"\u662F",value:!0},{label:"\u5426",value:!1}],placeholder:"\u8BF7\u9009\u62E9\u662F\u5426\u652F\u6301\u8F6C\u7B80\u8C31",onUpdateValue:r=>p(this,null,function*(){r||(l.defaultScore="STAVE")}),clearable:!0},null)]}),l.transferFlag&&t(s,{label:"\u9ED8\u8BA4\u8C31\u9762",path:"defaultScore",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762"}]},{default:()=>[t(_,{clearable:!0,value:l.defaultScore,"onUpdate:value":r=>l.defaultScore=r,placeholder:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762",options:L(w)},null)]}),t(s,{label:"\u4E50\u5668\u7F16\u7801",path:"code",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801"}]},{default:()=>[t(v,{value:l.code,"onUpdate:value":r=>l.code=r,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]}),t(s,{label:"\u4E50\u5668\u5C01\u9762",path:"img",rule:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u4E50\u5668\u5C01\u9762",trigger:["input","blur"]}]},{default:()=>[t(D,{fileList:l.img,"onUpdate:fileList":r=>l.img=r,accept:".jpg,.jpeg,.png",cropper:!0,size:5,class:N.updateFile,bucketName:"news-info",options:{enlarge:2,autoCropWidth:150,autoCropHeight:250},tips:"\u8BF7\u4E0A\u4F20\u6BD4\u4F8B\u4E3A3:5\uFF0CJPG\u3001PNG\u56FE\u7247"},null)]}),t(s,{label:"\u58F0\u90E8\u97F3\u9891",path:"media",rule:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u58F0\u90E8\u97F3\u9891"}]},{default:()=>[t(D,{size:10,fileList:l.media,"onUpdate:fileList":r=>l.media=r,listType:"image",bucketName:"gyt",tips:"\u8BF7\u4E0A\u4F20\u97F3\u9891\u6587\u4EF6",accept:".mp3"},null)]})]}),t(y,{justify:"end"},{default:()=>[t(m,{type:"default",onClick:()=>i("close")},{default:()=>[h("\u53D6\u6D88")]}),t(m,{type:"primary",onClick:()=>u(),loading:c.value},{default:()=>[h("\u4FDD\u5B58")]})]})])}}),ve=x({name:"instrument-list",setup(){const o=J(),n=I(),e=M({loading:!1,pagination:{page:1,rows:10,pageTotal:0},searchForm:{keyword:"",timer:null,startTime:null,endTime:null,defaultScore:null,code:null,operatorKeyword:null},dataList:[],showSave:!1,saveMode:"add",rowData:{}}),i=k(),l=()=>{e.pagination.page=1,r()},c=()=>{var a;(a=i.value)==null||a.submit()},g=a=>{const T=a.enableFlag?"\u505C\u7528":"\u542F\u7528";o.warning({title:"\u63D0\u793A",content:`\u662F\u5426${T}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>p(this,null,function*(){try{yield H({id:a.id}),r(),n.success(`${T}\u6210\u529F`)}catch(re){}})})},d=()=>{var a;(a=i.value)==null||a.reset()},u=()=>[{title:"\u7F16\u53F7",key:"id"},{title:"\u4E50\u5668\u540D\u79F0",key:"name"},{title:"\u4E50\u5668\u5C01\u9762",key:"img",render(a){return a.img&&t(Y,{src:a.img,style:{width:"80px",height:"80px"}},null)}},{title:"\u4E50\u5668\u7F16\u7801",key:"code"},{title:"\u58F0\u90E8",key:"subjectName"},{title:"\u9ED8\u8BA4\u8C31\u9762",key:"defaultScore",render(a){return R(a.defaultScore,new Map(Object.entries(w)))}},{title:"\u64CD\u4F5C\u4EBA",key:"operator",render(a){return t("div",null,[t("div",null,[a.operatorName]),t("div",null,[a.updateTime])])}},{title:"\u72B6\u6001",key:"enableFlag",render(a){return t(Z,{type:a.enableFlag?"primary":"default"},{default:()=>[a.enableFlag?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",render(a){return t(y,null,{default:()=>[b(t(m,{type:"primary",size:"small",text:!0,onClick:()=>{e.rowData=a,e.showSave=!0,e.saveMode="edit"}},{default:()=>[h("\u4FEE\u6539")]}),[[F("auth"),"musicalInstrument/update1750840718913437697"]]),b(t(m,{type:"primary",size:"small",text:!0,onClick:()=>g(a)},{default:()=>[a.enableFlag?"\u505C\u7528":"\u542F\u7528"]}),[[F("auth"),"musicalInstrument/enable1750840534934487042"]])]})}}],r=()=>p(this,null,function*(){try{e.loading=!0;const{data:a}=yield G(f(f(f({},e.pagination),e.searchForm),ee(e.searchForm.timer,["startTime","endTime"])));e.loading=!1,e.pagination.pageTotal=Number(a.total),e.dataList=a.rows||[]}catch(a){e.loading=!1}});return j(()=>{r()}),()=>t("div",{class:"system-menu-container"},[t("div",{class:["section-container"]},[t(K,{ref:i,model:e.searchForm,onSubmit:l,onSetModel:a=>Object.assign(e.searchForm,a)},{default:()=>[t(s,{path:"keyword",label:"\u5173\u952E\u5B57"},{default:()=>[t(v,{placeholder:"\u8BF7\u8F93\u5165\u7F16\u53F7/\u540D\u79F0",value:e.searchForm.keyword,"onUpdate:value":a=>e.searchForm.keyword=a,clearable:!0},null)]}),t(s,{path:"defaultScore",label:"\u9ED8\u8BA4\u8C31\u9762"},{default:()=>[t(_,{options:L(w),value:e.searchForm.defaultScore,"onUpdate:value":a=>e.searchForm.defaultScore=a,placeholder:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762",clearable:!0},null)]}),t(s,{path:"code",label:"\u4E50\u5668\u7F16\u7801"},{default:()=>[t(v,{value:e.searchForm.code,"onUpdate:value":a=>e.searchForm.code=a,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]}),t(s,{path:"operatorName",label:"\u64CD\u4F5C\u4EBA"},{default:()=>[t(v,{value:e.searchForm.operatorKeyword,"onUpdate:value":a=>e.searchForm.operatorKeyword=a,placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C\u4EBA",clearable:!0},null)]}),t(s,{path:"updateTime",label:"\u64CD\u4F5C\u65F6\u95F4"},{default:()=>[t(W,{value:e.searchForm.timer,"onUpdate:value":a=>e.searchForm.timer=a,type:"daterange",clearable:!0},null)]}),t(s,null,{default:()=>[t(y,null,{default:()=>[t(m,{type:"primary",onClick:c},{default:()=>[h("\u641C\u7D22")]}),t(m,{type:"default",onClick:d},{default:()=>[h("\u91CD\u7F6E")]})]})]})]}),t(y,{style:{paddingBottom:"12px"}},{default:()=>[b(t(m,{type:"primary",onClick:()=>{e.rowData={},e.showSave=!0,e.saveMode="add"}},{default:()=>[h("\u6DFB\u52A0")]}),[[F("auth"),"musicalInstrument/save1750840633332858882"]])]}),t(Q,{loading:e.loading,columns:u(),data:e.dataList,rowKey:a=>a.id},null),t(E,{page:e.pagination.page,"onUpdate:page":a=>e.pagination.page=a,pageSize:e.pagination.rows,"onUpdate:pageSize":a=>e.pagination.rows=a,pageTotal:e.pagination.pageTotal,"onUpdate:pageTotal":a=>e.pagination.pageTotal=a,onList:r,sync:!0},null)]),t(X,{show:e.showSave,"onUpdate:show":a=>e.showSave=a,preset:"dialog",showIcon:!1,title:e.saveMode==="add"?"\u65B0\u589E\u4E50\u5668":"\u4FEE\u6539\u4E50\u5668",style:{width:"500px"}},{default:()=>[t(le,{type:e.saveMode,data:e.rowData,onClose:()=>e.showSave=!1,onGetList:r},null)]})])}});export{ve as default};