var I=Object.defineProperty,j=Object.defineProperties;var K=Object.getOwnPropertyDescriptors;var C=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var D=(o,n,e)=>n in o?I(o,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[n]=e,f=(o,n)=>{for(var e in n||(n={}))P.call(n,e)&&D(o,e,n[e]);if(C)for(var e of C(n))V.call(n,e)&&D(o,e,n[e]);return o},b=(o,n)=>j(o,K(n));var p=(o,n,e)=>new Promise((i,l)=>{var c=s=>{try{d(e.next(s))}catch(r){l(r)}},g=s=>{try{d(e.throw(s))}catch(r){l(r)}},d=s=>s.done?i(s.value):Promise.resolve(s.value).then(c,g);d((e=e.apply(o,n)).next())});import{P as q}from"./index.c2964e13.js";import{S as B}from"./index.e6fc9d6c.js";import{h as E,i as z,c as A,j as O}from"./api.964d807b.js";import{g as G}from"./filters.de6e9e5f.js";import{C as w}from"./constant.ded25e36.js";import{g as _}from"./objectUtil.ec24ceed.js";import{U as H}from"./index.e4e636de.js";import{d as N,a as x,r as k,u as L,B as M,i as t,q as R,l as u,_ as y,ce as T,a9 as v,p as m,k as h,ai as $,cf as J,H as S,cg as W,aa as Q,ae as X,ch as Y,bC as F}from"./index.fd264fea.js";import{f as Z}from"./dateUtil.134dfe1f.js";import"./searchs.b637f0d6.js";import"./dayjs.min.bd923176.js";const ee=N({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=x({name:null,defaultScore:null,code:null,transferFlag:!0,img:null}),c=k(!1),g=k(),d=L(),s=()=>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 E(b(f({},l),{defaultScore:l.transferFlag?l.defaultScore:"STAVE"})),d.success("\u6DFB\u52A0\u6210\u529F")):o.type==="edit"&&(yield z(b(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 M(()=>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}})),()=>t("div",{style:"background: #fff; padding-top: 12px"},[t(R,{model:l,ref:g,"label-placement":"left","label-width":"100px"},{default:()=>[t(u,{label:"\u4E50\u5668\u540D\u79F0",path:"name",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u540D\u79F0"}]},{default:()=>[t(y,{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(u,{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(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(u,{label:"\u9ED8\u8BA4\u8C31\u9762",path:"defaultScore",rule:[{required:!0,message:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762"}]},{default:()=>[t(T,{clearable:!0,value:l.defaultScore,"onUpdate:value":r=>l.defaultScore=r,placeholder:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762",options:_(w)},null)]}),t(u,{label:"\u4E50\u5668\u7F16\u7801",path:"code",rule:[{required:!0,message:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801"}]},{default:()=>[t(y,{value:l.code,"onUpdate:value":r=>l.code=r,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]}),t(u,{label:"\u4E50\u5668\u5C01\u9762",path:"img",rule:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u4E50\u5668\u5C01\u9762",trigger:["input","blur"]}]},{default:()=>[t(H,{fileList:l.img,"onUpdate:fileList":r=>l.img=r,accept:".jpg,.jpeg,.png",cropper:!0,size:5,bucketName:"news-info",options:{enlarge:2,autoCropWidth:200,autoCropHeight:200},tips:"\u8BF7\u4E0A\u4F20\u6BD4\u4F8B\u4E3A1:1\uFF0CJPG\u3001PNG\u56FE\u7247"},null)]})]}),t(v,{justify:"end"},{default:()=>[t(m,{type:"default",onClick:()=>i("close")},{default:()=>[h("\u53D6\u6D88")]}),t(m,{type:"primary",onClick:()=>s(),loading:c.value},{default:()=>[h("\u4FDD\u5B58")]})]})])}}),ge=N({name:"instrument-list",setup(){const o=$(),n=L(),e=x({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 U=a.enableFlag?"\u505C\u7528":"\u542F\u7528";o.warning({title:"\u63D0\u793A",content:`\u662F\u5426${U}\uFF1F`,positiveText:"\u786E\u5B9A",negativeText:"\u53D6\u6D88",onPositiveClick:()=>p(this,null,function*(){try{yield O({id:a.id}),r(),n.success(`${U}\u6210\u529F`)}catch(ae){}})})},d=()=>{var a;(a=i.value)==null||a.reset()},s=()=>[{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(X,{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 G(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(Y,{type:a.enableFlag?"primary":"default"},{default:()=>[a.enableFlag?"\u542F\u7528":"\u505C\u7528"]})}},{title:"\u64CD\u4F5C",key:"operation",render(a){return t(v,null,{default:()=>[S(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"]]),S(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 A(f(f(f({},e.pagination),e.searchForm),Z(e.searchForm.timer,["startTime","endTime"])));e.loading=!1,e.pagination.pageTotal=Number(a.total),e.dataList=a.rows||[]}catch(a){e.loading=!1}});return M(()=>{r()}),()=>t("div",{class:"system-menu-container"},[t("div",{class:["section-container"]},[t(B,{ref:i,model:e.searchForm,onSubmit:l,onSetModel:a=>Object.assign(e.searchForm,a),saveKey:"instrument-list"},{default:()=>[t(u,{path:"keyword",label:"\u5173\u952E\u5B57"},{default:()=>[t(y,{placeholder:"\u8BF7\u8F93\u5165\u7F16\u53F7/\u540D\u79F0",value:e.searchForm.keyword,"onUpdate:value":a=>e.searchForm.keyword=a,clearable:!0},null)]}),t(u,{path:"defaultScore",label:"\u9ED8\u8BA4\u8C31\u9762"},{default:()=>[t(T,{options:_(w),value:e.searchForm.defaultScore,"onUpdate:value":a=>e.searchForm.defaultScore=a,placeholder:"\u8BF7\u9009\u62E9\u9ED8\u8BA4\u8C31\u9762",clearable:!0},null)]}),t(u,{path:"code",label:"\u4E50\u5668\u7F16\u7801"},{default:()=>[t(y,{value:e.searchForm.code,"onUpdate:value":a=>e.searchForm.code=a,placeholder:"\u8BF7\u8F93\u5165\u4E50\u5668\u7F16\u7801",clearable:!0},null)]}),t(u,{path:"operatorName",label:"\u64CD\u4F5C\u4EBA"},{default:()=>[t(y,{value:e.searchForm.operatorKeyword,"onUpdate:value":a=>e.searchForm.operatorKeyword=a,placeholder:"\u8BF7\u8F93\u5165\u64CD\u4F5C\u4EBA",clearable:!0},null)]}),t(u,{path:"updateTime",label:"\u64CD\u4F5C\u65F6\u95F4"},{default:()=>[t(J,{value:e.searchForm.timer,"onUpdate:value":a=>e.searchForm.timer=a,type:"daterange",clearable:!0},null)]}),t(u,null,{default:()=>[t(v,null,{default:()=>[t(m,{type:"primary",onClick:c},{default:()=>[h("\u641C\u7D22")]}),t(m,{type:"default",onClick:d},{default:()=>[h("\u91CD\u7F6E")]})]})]})]}),t(v,{style:{paddingBottom:"12px"}},{default:()=>[S(t(m,{type:"primary",onClick:()=>{e.rowData={},e.showSave=!0,e.saveMode="add"}},{default:()=>[h("\u6DFB\u52A0")]}),[[F("auth"),"musicalInstrument/save1750840633332858882"]])]}),t(W,{loading:e.loading,columns:s(),data:e.dataList,rowKey:a=>a.id},null),t(q,{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,saveKey:"login-device"},null)]),t(Q,{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(ee,{type:e.saveMode,data:e.rowData,onClose:()=>e.showSave=!1,onGetList:r},null)]})])}});export{ge as default};